问题描述
我正在使用YAML前端中的节点列表来构建网站中的页面,如下所示:
I am building the pages in my site with a list of nodes in the YAML front matter, like so:
---
title: My page
layout: default
nodes:
- header: Node header
text_block: >
This is supposed to be markdown.
[This works](http://example.com)
But:
- this
- doesn't
- work
---
然后:
{% for node in page.nodes %}
{{ node.text_block | markdownify }}
{% endfor %}
在上面的示例中,text_block的呈现方式如下:
In the above example, the text_block will be rendered like this:
不显示换行符和列表,而只是将它们放在一个大的<p>
标记中.
The line breaks and lists are not being rendered, it's all just put together in one big <p>
tag.
将渲染引擎更改为redcarpet
不起作用,将unindent
添加到markdownify
调用中也不会
Changing rendering engine to redcarpet
doesn't work, and neither does adding unindent
to the markdownify
call
有些东西告诉我,这与缩进级别有关,但我无法解决.
Something tells me this has to do with the indentation level, but I just can't work it out.
推荐答案
我发现了问题,这与YAML有关.我使用|
代替了在字段开头使用>
的方法,从而解决了该问题.
I found the problem, it was YAML related. Instead of using >
in the beginning of the field, I used |
, and it solved the problem.
这篇关于Jekyll:无法正确将YAML前项字段呈现为markdown的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!