post 中的 Jekyll 原始 HTML

Jekyll raw HTML in post

我有一个 Jekyll 网站,其中的帖子使用 Kramdown 解析器以 Markdown 编写。

我想在 post 中添加一些原始的 HTML。但是,当我尝试添加 HTML 时,它会将其解析为降价(例如,将 < 更改为 &lt;)。

我试过:

我所拥有的示例:

Some **markdown** `here`

<iframe src="asd"></iframe>

More *markdown*.

iframe 应输出为 HTML,而不是解析的文本。

我正在使用 Github 个页面,因此 Jekyll 扩展不是可选的。

HTML 被忽略,因为一些标签属性没有引号。例如 width=500 应该是 width="500"

没有其他要求。 HTML 在其自己的段落中,没有缩进,并且已被解析。

供其他人参考,为确保Kramdown不process/parse RAW HTML,可以添加属性markdown="0"。这将确保 Kramdown 解析器不会触及 HTML 标签块。

示例:

Input Markdown: - hello

Output HTML:

          <ul>
           <li>hello</li>
          </ul>

使用属性 markdown = "0":

Input markdown: <div markdown = "0"> - hello </div>

Output HTML: <div markdown = "0"> - hello </div>

来自 Kramdown documentation(提示:使用浏览器查找关键字 'raw' 以跳转到相关部分):

If an HTML tag has an attribute markdown="0", then the tag is parsed as raw HTML block.

If an HTML tag has an attribute markdown="1", then the default mechanism for parsing syntax in this tag is used.

If an HTML tag has an attribute markdown="block", then the content of the tag is parsed as block level elements.

If an HTML tag has an attribute markdown="span", then the content of the tag is parsed as span level elements.

此外,所有通用 XML 标签都被解析为原始 HTML 块。