Skip to content

Commit

Permalink
Merge pull request #100 from fumiX/98-Diagrams-do-not-appear-as-image
Browse files Browse the repository at this point in the history
fix escaped code return value from walkTokenizer from
  • Loading branch information
thooyork authored Jul 1, 2024
2 parents 63dece6 + f8d8233 commit 55dbf24
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion common/src/markdown-converter-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -133,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"],
}),
);
Expand Down

0 comments on commit 55dbf24

Please sign in to comment.