【发布时间】:2016-10-16 17:32:59
【问题描述】:
我正在开发一个 Jekyll 页面,该页面显示了一个项目列表,其中 markdownified-syntax 突出显示代码。我有一个内容像这样的数据文件
# myitems.yaml
id: 'someID'
updated: 'someDate'
items:
- item:
id: "0001"
content: "
*This is italicized*, and so is _this_.
**This is bold**, and so is __this__. &
Use ***italics and bold together*** if you ___have to___.
``` html
<script>alert() some content</script>
<p>paragraph</p>
```"
- item:
id: "0002"
content: "some more content"
所以items[].content 有markdown+一些代码要突出显示语法。
我在我的items.html 中使用液体作为访问这些数据
<ul>
{% for item in site.data.myitems.items %}
<li id="{{item.id}}">
<div>{{ item.content | strip | markdownify}}</div>
</li>
{% endfor %}
</ul>
我正在使用 rouge 语法高亮。 markdown 已正确解析为 html,但 html 语法突出显示在 items.html 部分中不起作用。语法突出显示在帖子正文中正常工作,但在 {% include items.html %}
<em>This is italicized</em>, and so is <em>this</em>. <strong>This is bold</strong>, and so is <strong>this</strong>. & Use <strong><em>italics and bold together</em></strong> if you <strong><em>have to</em></strong>. <code class="highlighter-rouge">html <script>alert() some content</script> <p>paragraph</p></code>
有什么帮助吗?
【问题讨论】: