我需要一些方法来保存代码或预阻塞内的标签,同时进行消毒。
例如:
<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>
应输出如下内容:
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>
使用常规/常规清理方法,输出为:
link
<code>
link
The link above and this p should not be sanitized, just converted to html special chars.
</code>