Jekyll-如何避免在YAML前题markdownify项上添加段落 [英] Jekyll - How can I make avoid a paragraph to be added on a YAML frontmatter markdownify item
问题描述
好的...我有一个项目,我正在使用Jekyll进行播客项目.我选择通过YAML的最重要的事项"项目列出所显示的主机:
Okay... I have a project where I'm using Jekyll for a podcast project. And I chose to list the hosts in the shownotes by a YAML Front Matter item:
hosts:
- Name A
- Name B
- Name C
使用这段代码
<li> <strong>Hosts:</strong>
<ul>
{% for host in page.hosts %}
<li>{{ host }}
{% endfor %}
</ul>
我收到正确的列表
<ul>
<li> <strong>Hosts:</strong>
<ul>
<li>Name A </li>
<li>Name B </li>
<li>Name C </li>
</ul>
</ul>
但是,我想通过这样做来降级
However, I want to markdownify this by doing
<li> <strong>Hosts:</strong>
<ul>
{% for host in page.hosts %}
<li>{{ host | markdownify }}
{% endfor %}
</ul>
但杰基尔返回:
<ul>
<li> <strong>Hosts:</strong>
<ul>
<li><p>Name A </p></li>
<li><p>Name B </p></li>
<li><p>Name C </p></li>
</ul>
</ul>
有什么方法可以禁止Jekyll将<p>
标签添加到列表项中?实际上,如果我想添加任何丰富的格式,则需要直接将HTML放入项目中,但是我想通过Markdown'ing the Front Matter文本来添加它.有什么建议吗?
Any way to forbid Jekyll to add the <p>
tag into the list item? Actually, if I want to add any rich formatting, I need to put HTML directly into the items, but I want to add it via Markdown'ing the Front Matter text. Any suggestions?
PS::我的网站托管在Github Pages
PS: my site is hosted at Github Pages
推荐答案
您可以使用像这样删除过滤器:
{{ host | markdownify | remove: '<p>' | remove: '</p>' }}
这篇关于Jekyll-如何避免在YAML前题markdownify项上添加段落的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!