From da526b1fe12da75c3bf3a2f213771d9038ff7d20 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 17 Jul 2023 11:59:55 +0200 Subject: [PATCH] Replace marked namespaces with Marked instance Based on a new addition to marked, this commits replaces the imported marked namespaces with a Marked class, that doesn't change when `marked.use` introduces new options or extensions. Also changes the naming slighty to use `markdown` as module, so it sounds more generic. Reference: https://github.com/markedjs/marked/pull/2831 Signed-off-by: Sebastian Martinez --- package-lock.json | 8 ++-- package.json | 2 +- src/components/InlineMarkdown.svelte | 4 +- src/components/Markdown.svelte | 16 +++----- src/lib/markdown.ts | 60 ++++++++++++++-------------- 5 files changed, 42 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index 40ec058fb2..ff91c236f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "@types/dompurify": "^3.0.2", "@types/katex": "^0.16.0", "@types/lodash": "^4.14.195", - "@types/marked": "^5.0.0", + "@types/marked": "^5.0.1", "@types/md5": "^2.3.2", "@types/node": "^18.16.12", "@types/sinon": "^10.0.15", @@ -836,9 +836,9 @@ "dev": true }, "node_modules/@types/marked": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/marked/-/marked-5.0.0.tgz", - "integrity": "sha512-YcZe50jhltsCq7rc9MNZC/4QB/OnA2Pd6hrOSTOFajtabN+38slqgDDCeE/0F83SjkKBQcsZUj7VLWR0H5cKRA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/marked/-/marked-5.0.1.tgz", + "integrity": "sha512-Y3pAUzHKh605fN6fvASsz5FDSWbZcs/65Q6xYRmnIP9ZIYz27T4IOmXfH9gWJV1dpi7f1e7z7nBGUTx/a0ptpA==", "dev": true }, "node_modules/@types/md5": { diff --git a/package.json b/package.json index 5b647ed7dd..f5dc5b88ba 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@types/dompurify": "^3.0.2", "@types/katex": "^0.16.0", "@types/lodash": "^4.14.195", - "@types/marked": "^5.0.0", + "@types/marked": "^5.0.1", "@types/md5": "^2.3.2", "@types/node": "^18.16.12", "@types/sinon": "^10.0.15", diff --git a/src/components/InlineMarkdown.svelte b/src/components/InlineMarkdown.svelte index 4302e33ef4..7083121a76 100644 --- a/src/components/InlineMarkdown.svelte +++ b/src/components/InlineMarkdown.svelte @@ -1,14 +1,14 @@