定义列表扩展(Markdig 规范文档)
本节描述了支持的不同扩展:
定义列表
自定义容器类似于围栏代码块,但它使用字符 :
来声明一个块(至少 3 个字符),而不是生成 <pre><code>...</code></pre>
,它将生成一个 <div>...</div>
块。
Term 1
: This is a definition item
With a paragraph
> This is a block quote
- This is a list
- with an item2
```java
Test
```
And a last line
: This ia another definition item
Term2
Term3 *with some inline*
: This is another definition for term2
.
<dl>
<dt>Term 1</dt>
<dd><p>This is a definition item
With a paragraph</p>
<blockquote>
<p>This is a block quote</p>
</blockquote>
<ul>
<li>This is a list</li>
<li>with an item2</li>
</ul>
<pre><code class="language-java">Test
</code></pre>
<p>And a last line</p>
</dd>
<dd>This ia another definition item</dd>
<dt>Term2</dt>
<dt>Term3 <em>with some inline</em></dt>
<dd>This is another definition for term2</dd>
</dl>
一个定义术语后面最多可以跟一行空行。定义支持懒惰延续:
Term 1
: Definition
with lazy continuation.
Second paragraph of the definition.
.
<dl>
<dt>Term 1</dt>
<dd><p>Definition
with lazy continuation.</p>
<p>Second paragraph of the definition.</p>
</dd>
</dl>
定义必须缩进 4 个字符,包括 :
。
Term 1
: Invalid with less than 3 characters
.
<p>Term 1</p>
<p>: Invalid with less than 3 characters</p>
:
可以缩进最多 3 个空格:
Term 1
: Valid even if `:` starts at most 3 spaces
.
<dl>
<dt>Term 1</dt>
<dd>Valid even if <code>:</code> starts at most 3 spaces</dd>
</dl>
但 :
前面超过 3 个空格将触发缩进的代码块:
Term 1
: Not valid
.
<p>Term 1</p>
<pre><code>: Not valid
</code></pre>
定义列表可以嵌套在列表项中:
1. First
2. Second
Term 1
: Definition
Term 2
: Second Definition
.
<ol>
<li><p>First</p></li>
<li><p>Second</p>
<dl>
<dt>Term 1</dt>
<dd>Definition</dd>
<dt>Term 2</dt>
<dd>Second Definition</dd>
</dl></li>
</ol>