size: 1 KiB

1Fenced divs are containers for sequences of blocks, to
2which an attribute can be attached.
3
4A fenced div begins with an opening fence: a line with
5three or more consecutive `:` characters, followed optionally by
6a class name and optionally whitespace.
7
8It ends with a closing fence: a line beginning with three
9or more consecutive `:` characters, followed by optional
10whitespace and the end of the line. The number of `:` characters
11in the closing fence must be at least the number in the opening fence.
12
13If the end of the input (or enclosing block) is encountered
14before a closing fence, the fenced div is implicitly closed.
15
16```
17:::::::::: foo
18Hi
19
20> A block quote.
21:::::::::::
22.
23<div class="foo">
24<p>Hi</p>
25<blockquote>
26<p>A block quote.</p>
27</blockquote>
28</div>
29```
30
31```
32{#bar .foo}
33:::
34Hi
35
36> A block quote.
37:::::::::::::
38.
39<div class="foo" id="bar">
40<p>Hi</p>
41<blockquote>
42<p>A block quote.</p>
43</blockquote>
44</div>
45```
46
47Fenced divs may be nested.
48
49```
50{#bar .foo}
51::::
52Hi
53
54::: baz
55> A block quote.
56:::
57::::
58.
59<div class="foo" id="bar">
60<p>Hi</p>
61<div class="baz">
62<blockquote>
63<p>A block quote.</p>
64</blockquote>
65</div>
66</div>
67```
68
69A fenced div cannot interrupt a paragraph, without
70an intervening blank line.
71
72```
73Paragraph text
74::::
75Hi
76::::
77.
78<p>Paragraph text
79::::
80Hi
81::::</p>
82```
83
84A fenced div need not have attributes or a class name.
85
86```
87::::
88Hi
89::::
90.
91<div>
92<p>Hi</p>
93</div>
94```
95
96The closing fence must be at least as long as the opening fence.
97
98```
99::::::::: foo
100Hi
101::::
102.
103<div class="foo">
104<p>Hi
105::::</p>
106</div>
107```
108
109If the end of the input (or enclosing block) is encountered
110before a closing fence, the fenced div is implicitly closed.
111
112```
113> :::: foo
114> Hi
115.
116<blockquote>
117<div class="foo">
118<p>Hi</p>
119</div>
120</blockquote>
121```
122
123````
124::: outer
125```
126:::
127```
128:::
129.
130<div class="outer">
131<pre><code>:::
132</code></pre>
133</div>
134````