core: fix md export for notes with codeblocks

This commit is contained in:
Abdullah Atta
2022-10-18 17:29:28 +05:00
parent f6b095ffb8
commit d42f617d0f
16 changed files with 13961 additions and 9060 deletions

File diff suppressed because it is too large Load Diff

14751
apps/web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -56,7 +56,6 @@
"react-scroll-sync": "^0.9.0", "react-scroll-sync": "^0.9.0",
"react-toggle": "^4.1.2", "react-toggle": "^4.1.2",
"react-virtuoso": "^3.0.0", "react-virtuoso": "^3.0.0",
"showdown": "github:thecodrr/showdown",
"timeago.js": "^4.0.2", "timeago.js": "^4.0.2",
"w3c-keyname": "^2.2.6", "w3c-keyname": "^2.2.6",
"web-streams-polyfill": "^3.1.1", "web-streams-polyfill": "^3.1.1",

View File

@@ -21,7 +21,7 @@ import Collection from "./collection";
import Note from "../models/note"; import Note from "../models/note";
import getId from "../utils/id"; import getId from "../utils/id";
import { getContentFromData } from "../content-types"; import { getContentFromData } from "../content-types";
import qclone from "qclone/src/qclone"; import qclone from "qclone";
import { deleteItem, findById } from "../utils/array"; import { deleteItem, findById } from "../utils/array";
/** /**

View File

@@ -1,5 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`convert HTML to markdown with codeblock2: html-to-md-codeblock2.md 1`] = `
"\`\`\`
hello
\`\`\`
"
`;
exports[`convert HTML to markdown with codeblocks: html-to-md-codeblocks.md 1`] = ` exports[`convert HTML to markdown with codeblocks: html-to-md-codeblocks.md 1`] = `
"Typescript is one of those languages that appear to be very simple. It's often described as \\"Javascript with types\\" and it fits that name very well. However, what many don't realize starting out with Typescript is that Typescript*is *a language and like all other languages it has it's own \\"secrets\\", it's own set of quirks. "Typescript is one of those languages that appear to be very simple. It's often described as \\"Javascript with types\\" and it fits that name very well. However, what many don't realize starting out with Typescript is that Typescript*is *a language and like all other languages it has it's own \\"secrets\\", it's own set of quirks.

File diff suppressed because one or more lines are too long

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import showdown from "showdown"; import showdown from "@streetwriters/showdown";
import dataurl from "../utils/dataurl"; import dataurl from "../utils/dataurl";
import { getDummyDocument, parseHTML } from "../utils/html-parser"; import { getDummyDocument, parseHTML } from "../utils/html-parser";

File diff suppressed because it is too large Load Diff

View File

@@ -36,6 +36,7 @@
"@microsoft/signalr": "^6.0.7", "@microsoft/signalr": "^6.0.7",
"@microsoft/signalr-protocol-msgpack": "^6.0.7", "@microsoft/signalr-protocol-msgpack": "^6.0.7",
"@notesnook/logger": "*", "@notesnook/logger": "*",
"@streetwriters/showdown": "^3.0.1-alpha",
"async-mutex": "^0.3.2", "async-mutex": "^0.3.2",
"base64-arraybuffer": "^1.0.2", "base64-arraybuffer": "^1.0.2",
"dayjs": "^1.11.3", "dayjs": "^1.11.3",
@@ -45,7 +46,6 @@
"linkedom": "^0.14.17", "linkedom": "^0.14.17",
"liqe": "^1.13.0", "liqe": "^1.13.0",
"qclone": "^1.1.0", "qclone": "^1.1.0",
"showdown": "github:thecodrr/showdown",
"spark-md5": "^3.0.2" "spark-md5": "^3.0.2"
}, },
"np": { "np": {

View File

@@ -7,7 +7,7 @@
"": { "": {
"name": "@notesnook/crypto-worker", "name": "@notesnook/crypto-worker",
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "GPL-3.0-or-later",
"dependencies": { "dependencies": {
"comlink": "^4.3.1" "comlink": "^4.3.1"
}, },
@@ -21,9 +21,9 @@
"integrity": "sha512-+YbhUdNrpBZggBAHWcgQMLPLH1KDF3wJpeqrCKieWQ8RL7atmgsgTQko1XEBK6PsecfopWNntopJ+ByYG1lRaA==" "integrity": "sha512-+YbhUdNrpBZggBAHWcgQMLPLH1KDF3wJpeqrCKieWQ8RL7atmgsgTQko1XEBK6PsecfopWNntopJ+ByYG1lRaA=="
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@@ -41,9 +41,9 @@
"integrity": "sha512-+YbhUdNrpBZggBAHWcgQMLPLH1KDF3wJpeqrCKieWQ8RL7atmgsgTQko1XEBK6PsecfopWNntopJ+ByYG1lRaA==" "integrity": "sha512-+YbhUdNrpBZggBAHWcgQMLPLH1KDF3wJpeqrCKieWQ8RL7atmgsgTQko1XEBK6PsecfopWNntopJ+ByYG1lRaA=="
}, },
"typescript": { "typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true "dev": true
} }
} }

View File

@@ -7,7 +7,7 @@
"": { "": {
"name": "@notesnook/crypto", "name": "@notesnook/crypto",
"version": "1.0.1", "version": "1.0.1",
"license": "MIT", "license": "GPL-3.0-or-later",
"dependencies": { "dependencies": {
"libsodium-wrappers": "0.7.9" "libsodium-wrappers": "0.7.9"
}, },
@@ -36,9 +36,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@@ -70,9 +70,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true "dev": true
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -7,15 +7,15 @@
"": { "": {
"name": "@notesnook/logger", "name": "@notesnook/logger",
"version": "1.0.3", "version": "1.0.3",
"license": "MIT", "license": "GPL-3.0-or-later",
"devDependencies": { "devDependencies": {
"typescript": "^4.8.2" "typescript": "^4.8.2"
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@@ -28,9 +28,9 @@
}, },
"dependencies": { "dependencies": {
"typescript": { "typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true "dev": true
} }
} }

View File

@@ -7,7 +7,7 @@
"": { "": {
"name": "@notesnook/streamable-fs", "name": "@notesnook/streamable-fs",
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "GPL-3.0-or-later",
"dependencies": { "dependencies": {
"localforage": "^1.10.0" "localforage": "^1.10.0"
}, },
@@ -48,9 +48,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@@ -93,9 +93,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true "dev": true
} }
} }

View File

@@ -7,7 +7,7 @@
"": { "": {
"name": "@notesnook/theme", "name": "@notesnook/theme",
"version": "1.0.1", "version": "1.0.1",
"license": "GPL-3.0", "license": "GPL-3.0-or-later",
"dependencies": { "dependencies": {
"@theme-ui/core": "^0.14.7", "@theme-ui/core": "^0.14.7",
"tinycolor2": "^1.4.2" "tinycolor2": "^1.4.2"
@@ -61,9 +61,9 @@
"dev": true "dev": true
}, },
"node_modules/csstype": { "node_modules/csstype": {
"version": "3.0.11", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.1.tgz",
"integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==" "integrity": "sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw=="
}, },
"node_modules/deepmerge": { "node_modules/deepmerge": {
"version": "4.2.2", "version": "4.2.2",
@@ -82,9 +82,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@@ -129,9 +129,9 @@
"dev": true "dev": true
}, },
"csstype": { "csstype": {
"version": "3.0.11", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.1.tgz",
"integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==" "integrity": "sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw=="
}, },
"deepmerge": { "deepmerge": {
"version": "4.2.2", "version": "4.2.2",
@@ -144,9 +144,9 @@
"integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==" "integrity": "sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA=="
}, },
"typescript": { "typescript": {
"version": "4.8.2", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true "dev": true
} }
} }