Skip to content

hr

在文本前后放置水平分隔线。

语法

knap
{{ value | hr }}
{{ value | hr:before }}
{{ value | hr:both }}

用法

  • after(默认)、beforeboth 选择分隔线的位置。
  • 该过滤器输出 ---,并用空行把它与内容隔开。
  • 对于数组和对象(包括来自其他过滤器、已序列化的集合),其中的字符串取值会被递归格式化,而键和非字符串取值保持不变。

示例

之后

Data
json
{
  "text": "Section end"
}
Template
knap
{{ text | hr }}
Output
md
Section end

---

之前

Data
json
{
  "text": "Section start"
}
Template
knap
{{ text | hr:before }}
Output
md
---

Section start