如何解决忽略 markdown-it 中指定的 HTML 块?
我有以下降价:
> Acronis True Image does not allow to clone a single partition; only cloning of an entire disk is possible
> [Acronis True Image: how to clone a disk | KNowledge Base](https://kb.acronis.com/content/56634)
But you can use <a href="https://px.a8.net/svt/ejp?a8mat=3H7MDC+20NGN6+49QG+5YJRM" rel="nofollow">this</a><img border="0" width="1" height="1" src="https://www11.a8.net/0.gif?a8mat=3H7MDC+20NGN6+49QG+5YJRM" alt="">.
markdown-it 渲染成这样:
<blockquote>
<p>Acronis True Image does not allow to clone a single partition; only cloning of an entire disk is possible
<a href="https://kb.acronis.com/content/56634">Acronis True Image: how to clone a disk | KNowledge Base</a></p>
</blockquote>
<p>But you can use <a href="https://px.a8.net/svt/ejp?a8mat=3H7MDC+20NGN6+49QG+5YJRM" rel="nofollow">this</a><img border="0" width="1" height="1" src="https://www11.a8.net/0.gif?a8mat=3H7MDC+20NGN6+49QG+5YJRM" alt="">.</p>
但实际上我想把它渲染成这样:
<blockquote>
<p>Acronis True Image does not allow to clone a single partition; only cloning of an entire disk is possible
<a href="https://kb.acronis.com/content/56634">Acronis True Image: how to clone a disk | KNowledge Base</a></p>
</blockquote>
<p>But you can use <a href="https://px.a8.net/svt/ejp?a8mat=3H7MDC+20NGN6+49QG+5YJRM" rel="nofollow">this</a><img border="0" width="1" height="1" src="https://www11.a8.net/0.gif?a8mat=3H7MDC+20NGN6+49QG+5YJRM" alt="">.</p>
我该怎么做?
解决方法
您需要启用 html
选项:
var md = require('markdown-it')({
html: true,});
作为 documented,html
在默认情况下是禁用的,这解释了它被转义的原因。
选项:
-
html -
false
。设置true
以启用源代码中的 HTML 标记。当心!那不安全!您可能需要外部消毒剂来保护 XSS 的输出。最好通过插件扩展功能,而不是 启用 HTML。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。