Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/core/render/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ function walkFetchEmbed({ embedTokens, compile, fetch }, cb) {
);
} else if (token.embed.type === 'mermaid') {
embedToken = [
{ type: 'html', text: `<div class="mermaid">\n${text}\n</div>` },
{
type: 'html',
text: `<div class="mermaid">\n${text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/"/g, '&quot;')}\n</div>`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should use a more robust solution like described in the following SO question so that it accounts for other characters, not just those specific ones?

https://stackoverflow.com/questions/18749591/encode-html-entities-in-javascript

},
];
embedToken.links = {};
} else {
Expand Down