How to preserve tags inside pre or code while sanitizing?
I need some way to preserve tags inside a code or a pre block, while sanitizing.
For example:
<a href="http://sanitize.com">link</开发者_运维技巧a>
<code>
<a href="http://donotsanitize.com">link</a>
<p>The link above and this p should not be sanitized, just converted to html special chars.</p>
</code>
Should output something like:
link
<code>
<a href="http://donotsanitize.com">link</a>
<p>The link above and this p should not be sanitized, just converted to html special chars.</p>
</code>
With common/regular sanitization methods the output is:
link
<code>
link
The link above and this p should not be sanitized, just converted to html special chars.
</code>
精彩评论