-
-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XML code is removed #992
Comments
Hey there :) Have you tried to modify the https://github.com/cure53/DOMPurify?tab=readme-ov-file#influence-how-we-sanitize |
Thanks for the response. I will try, |
It did not work. I think something wrong with the html. Those xml tags are not treaded as tags, or something, are being removed |
You need to of course also allow-list the tags you want to keep. By default, DOMPurify will remove everything it doesn't know and recognize as harmless |
Background & Context
I want to parse some xml code. I checked cure53.de/purify and yes it does remove xml tags,
but I want them present in the final html
My config
Input
<h2 class="slate-h2 "> myhtml</h2><div class="code-block-wrapper" style="width:60%"><div class="code-block-header">XML</div><pre class="slate-CodeBlockElement slate-code_block"><code class="language-xml keep-markup drop-tokens"><div class="slate-code_line"></div><div class="slate-code_line"> <glossary>example glossary</glossary></div><div class="slate-code_line"> <glossdiv><title>S</title></glossdiv></div><div class="slate-code_line"> <glosslist></glosslist></div><div class="slate-code_line"> <glossentry id="SGML" sortas="SGML"></glossentry></div><div class="slate-code_line"> <glossterm>Standard Generalized Markup Language</glossterm></div><div class="slate-code_line"> <acronym>SGML</acronym></div><div class="slate-code_line"> <abbrev>ISO 8879:1986</abbrev></div><div class="slate-code_line"> <glossdef></glossdef></div><div class="slate-code_line"> <para>A meta-markup language, used to create markup</para></div><div class="slate-code_line">languages such as DocBook.</div><div class="slate-code_line"> <glossseealso otherterm="GML"></glossseealso></div><div class="slate-code_line"> <glossseealso otherterm="XML"></glossseealso></div><div class="slate-code_line"> </div><div class="slate-code_line"> <glosssee otherterm="markup"></glosssee></div><div class="slate-code_line"> </div><div class="slate-code_line"> </div><div class="slate-code_line"> </div><div class="slate-code_line"> </div></code></pre></div><p class="slate-p "></p><p class="slate-p "></p><p class="slate-p "></p>
Given output
<h2 class="slate-h2">myhtml</h2><div style="width:60%" class="code-block-wrapper"><div class="code-block-header">XML</div><pre class="slate-CodeBlockElement slate-code_block"><code class="language-xml keep-markup drop-tokens"><div class="slate-code_line"></div><div class="slate-code_line"> example glossary</div><div class="slate-code_line"> <title>S</title></div><div class="slate-code_line"> </div><div class="slate-code_line"> </div><div class="slate-code_line"> Standard Generalized Markup Language</div><div class="slate-code_line"> <acronym>SGML</acronym></div><div class="slate-code_line"> ISO 8879:1986</div><div class="slate-code_line"> </div><div class="slate-code_line"> A meta-markup language, used to create markup</div><div class="slate-code_line">languages such as DocBook.</div><div class="slate-code_line"> </div><div class="slate-code_line"> </div><div class="slate-code_line"> </div><div class="slate-code_line"> </div><div class="slate-code_line"> </div><div class="slate-code_line"> </div><div class="slate-code_line"> </div><div class="slate-code_line"> </div></code></pre></div><p class="slate-p"></p><p class="slate-p"></p><p class="slate-p"></p>
Expected output
Expected output is to not remove xml tags
I posted this in the isomorphic-dompurify. I don't know If this still maintained
Thanks
The text was updated successfully, but these errors were encountered: