Jekyll Liquid:对整个包含文件使用 truncatewords 过滤器
Jekyll Liquid: use truncatewords filter on a whole included file
Jekyll 和 Liquid 中有没有办法包含另一个文件并截断其中的单词数?
{{ {% include intro.md %} | truncatewords: 3 }}
无论我如何设置花括号,都不走运...
单独包含 intro.md 有效:
{% include intro_DE.md %}
这里有一个 vague note,在 Jekyll 下,include 可能有点不同,但我仍然不知道...
也许,我需要经历capture?
我找到了捕获的解决方案。就是不太优雅:
{% capture foo %}{% include intro_DE.md %}{% endcapture %}
{{ foo | truncatewords: 20 }}
输出仍然是 markdown-ish (=good)。粗体、下划线、删除线等“内联样式”仍然有效。
### Headlines
和 <html tags>
没有。 (可能是因为这种技术消除了换行...)
"truncatewords" 仅适用于字符串数据类型,
例如:如果我们必须在卡片描述中使用有限的词,那么最好使用截断词。
[更多信息请阅读本文] https://shopify.github.io/liquid/filters/truncatewords/
Jekyll 和 Liquid 中有没有办法包含另一个文件并截断其中的单词数?
{{ {% include intro.md %} | truncatewords: 3 }}
无论我如何设置花括号,都不走运...
单独包含 intro.md 有效:
{% include intro_DE.md %}
这里有一个 vague note,在 Jekyll 下,include 可能有点不同,但我仍然不知道...
也许,我需要经历capture?
我找到了捕获的解决方案。就是不太优雅:
{% capture foo %}{% include intro_DE.md %}{% endcapture %}
{{ foo | truncatewords: 20 }}
输出仍然是 markdown-ish (=good)。粗体、下划线、删除线等“内联样式”仍然有效。
### Headlines
和 <html tags>
没有。 (可能是因为这种技术消除了换行...)
"truncatewords" 仅适用于字符串数据类型, 例如:如果我们必须在卡片描述中使用有限的词,那么最好使用截断词。 [更多信息请阅读本文] https://shopify.github.io/liquid/filters/truncatewords/