内联HTML被Jekyll逸出 [英] Inline HTML is escaped by Jekyll

查看:47
本文介绍了内联HTML被Jekyll逸出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在github页面中遇到了内联HTML的问题,其中内联HTML项目符号列表在表中进行了转义.下表的行:

I have a problem with inline HTML in a github page, where inline HTML bullet lists are escaped in tables. The rows of the following table:

| Name | Value                 |
|------|-----------------------|
| one  | <i>foo</i>            |
| two  | <ul><li>bar</li></ul> |

表示为:

<tr>
  <td>one</td>
  <td><i>foo</i></td>
</tr>
<tr>
  <td>two</td>
  <td>&lt;ul&gt;&lt;li&gt;bar&lt;/li&gt;&lt;/ul&gt;</td>
</tr>

项目符号列表按GitHub UI的要求呈现,但是在gh-pages中,<ul>被转义.为什么?

The bullet list is rendered as expected by the GitHub UI, but in gh-pages, the <ul> is escaped. Why?

推荐答案

这是由 Kramdown 实现的a>,即在GitHub中渲染Markdown的Markdown处理器页面.

This is by design as implemented by Kramdown, which is the Markdown processor that renders Markdown in GitHub pages.

Kramdown将每一行都视为一行,并且不会在表单元格中呈现Markdown项目符号列表,并且代替呈现HTML,而是将其转义并输出为一行文本.

Kramdown treats each new line as a row and doesn't render Markdown bullet lists inside table cells, and instead of rendering HTML, it is escaped and outputted as a single line of text.

您可以使用 nomarkdown扩展<.只需将HTML代码包装为{::nomarkdown} ... {:/}

You can tell Kramdown to leave the HTML alone and output as is, with the nomarkdown extension. Just wrap the HTML code with {::nomarkdown} ... {:/}

例如

| Name | Value                                   |
|------|-----------------------------------------|
| one  | {::nomarkdown}<i>foo</i>{:/}            |
| two  | {::nomarkdown}<ul><li>bar</li></ul>{:/} |

这篇关于内联HTML被Jekyll逸出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆