Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will extend
html
option to support whitelisting. This idea is a feedback from discussion in security issue on yhatt/marp#187.At first, we have tried to sanitize by using sanitize-html package. But it does not parse a fragment HTML token of markdown-it correctly. When using sanitize-html,
<b>abc</b>
(tokens:['<b>', 'abc', '</b>']
) will convert to<b></b>abc
(['<b></b>', 'abc', '']
). The reason is that elements will close automatically byhtmlparser2.end()
(As same as yhatt/markdown-it-incremental-dom#34).We will adopt js-xss to sanitize. It can sanitize HTML fragments even if passed only open or close element.
We would allow only
<br>
tag by default whitelist. It is useful in multi-line headings.