我正在使用Showdown。
当我运行这段代码时:
const showdown = require("showdown")
converter = new showdown.Converter()
const myMarkdownText = '## Some important text'
const myHtmlText = converter.makeHtml(myMarkdownText)我得到了
<h2 id="someimportanttext">Some important text</h2>这是预期的结果。
但是当我运行这段代码时:
const showdown = require("showdown")
converter = new showdown.Converter()
const myMarkdownText = '<div markdown = "1"> ## Some important text </div>'
const myHtmlText = converter.makeHtml(myMarkdownText)我得到了
<div markdown = "1"><p>## Some important text </p></div>这意味着Showdown没有解析html div中的内容。
有什么关于如何让它工作的帮助吗?
发布于 2020-05-31 20:21:39
在阅读了展示文档(https://github.com/showdownjs/showdown#valid-options)之后,我的结论是您可能应该启用backslashEscapesHTMLTags选项并去掉html标记。
https://stackoverflow.com/questions/62115225
复制相似问题