From 35988df1181e2c741cfc6a73a0943950ea138ef2 Mon Sep 17 00:00:00 2001 From: Thomas Haaf Date: Tue, 25 Jun 2024 09:24:23 +0200 Subject: [PATCH 1/2] fix escaped code return value from walkTokenizer from --- common/src/markdown-converter-common.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/src/markdown-converter-common.ts b/common/src/markdown-converter-common.ts index 199f18e..6d0f14b 100644 --- a/common/src/markdown-converter-common.ts +++ b/common/src/markdown-converter-common.ts @@ -105,6 +105,9 @@ export abstract class MarkdownConverter { if (token.type === "image") { token.href = (await this.f?.(token.href).catch(() => undefined)) ?? token.href; } + if (token.type === "code") { + token.escaped = true; + } }, }); marked.use(MarkdownConverter.rendererExtension); From f8d82336b36a3ad8d13ce454f29b339973ec4c9c Mon Sep 17 00:00:00 2001 From: Thomas Haaf Date: Tue, 25 Jun 2024 10:39:17 +0200 Subject: [PATCH 2/2] fix missing text on mermaid diagrams --- common/src/markdown-converter-common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/markdown-converter-common.ts b/common/src/markdown-converter-common.ts index 6d0f14b..da72dba 100644 --- a/common/src/markdown-converter-common.ts +++ b/common/src/markdown-converter-common.ts @@ -136,7 +136,7 @@ export abstract class MarkdownConverter { .then((parsedInput) => this.dompurify.sanitize(parsedInput, { // Allowed tags and attributes inside markdown - ADD_TAGS: ["iframe"], + ADD_TAGS: ["iframe", "foreignObject"], // foreignObject is needed for SVGs that show html tags inside them like mermaid-diagrams ADD_ATTR: ["allow", "allowfullscreen", "frameborder", "scrolling"], }), );