YAML 前置内容解析扩展(Markdig 规范文档)
添加了对 YAML 前置内容解析的支持:
YAML 前置内容丢弃
如果存在前置内容,它将不会被渲染:
---
this: is a frontmatter
---
This is a text
.
<p>This is a text</p>
但如果前置内容不在第一行,它将被解析为常规 Markdown 内容
This is a text1
---
this: is a frontmatter
---
This is a text2
.
<h2>This is a text1</h2>
<h2>this: is a frontmatter</h2>
<p>This is a text2</p>
它期望精确的三个破折号 ---
:
----
this: is a frontmatter
----
This is a text
.
<hr />
<h2>this: is a frontmatter</h2>
<p>This is a text</p>
它可以以三个点 ...
结束:
---
this: is a frontmatter
...
This is a text
.
<p>This is a text</p>
如果结束前置内容标记(...
或 ---
)不存在,那么 ---
将被渲染为 <hr>
:
---
this: is a frontmatter
This is a text
.
<hr />
<p>this: is a frontmatter
This is a text</p>
它期望恰好三个点 ...
:
---
this: is a frontmatter
....
This is a text
.
<hr />
<p>this: is a frontmatter
....
This is a text</p>
前置内容在遇到包含三个点 ...
或三个破折号 ---
的行时结束:
---
this: is a frontmatter
....
Hello
---
This is a text
.
<p>This is a text</p>
允许在引导字符后存在空格:
---
this: is a frontmatter
...
This is a text
.
<p>This is a text</p>
允许在尾随字符后存在空格:
---
this: is a frontmatter
...
This is a text
.
<p>This is a text</p>