Skip to content

strip_md

移除 Markdown 格式但保留可读文本。

语法

knap
{{ value | strip_md }}

用法

  • 移除强调、高亮、标题、代码、引用块、列表和 wikilink 等格式。
  • 图片、表格、脚注引用、围栏代码块、URL 和 HTML 标签会被移除,而不是转换为可见文本。

示例

行内格式

Data
json
{
  "text": "**Bold** and [linked](https://example.com)"
}
Template
knap
{{ text | strip_md }}
Output
md
Bold and linked

块级格式

Data
json
{
  "text": "# Heading\n\n> Quoted text"
}
Template
knap
{{ text | strip_md }}
Output
md
Heading

Quoted text