size: 1 KiB
| 1 | Fenced divs are containers for sequences of blocks, to |
| 2 | which an attribute can be attached. |
| 3 | |
| 4 | A fenced div begins with an opening fence: a line with |
| 5 | three or more consecutive `:` characters, followed optionally by |
| 6 | a class name and optionally whitespace. |
| 7 | |
| 8 | It ends with a closing fence: a line beginning with three |
| 9 | or more consecutive `:` characters, followed by optional |
| 10 | whitespace and the end of the line. The number of `:` characters |
| 11 | in the closing fence must be at least the number in the opening fence. |
| 12 | |
| 13 | If the end of the input (or enclosing block) is encountered |
| 14 | before a closing fence, the fenced div is implicitly closed. |
| 15 | |
| 16 | ``` |
| 17 | :::::::::: foo |
| 18 | Hi |
| 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 | ::: |
| 34 | Hi |
| 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 | |
| 47 | Fenced divs may be nested. |
| 48 | |
| 49 | ``` |
| 50 | {#bar .foo} |
| 51 | :::: |
| 52 | Hi |
| 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 | |
| 69 | A fenced div cannot interrupt a paragraph, without |
| 70 | an intervening blank line. |
| 71 | |
| 72 | ``` |
| 73 | Paragraph text |
| 74 | :::: |
| 75 | Hi |
| 76 | :::: |
| 77 | . |
| 78 | <p>Paragraph text |
| 79 | :::: |
| 80 | Hi |
| 81 | ::::</p> |
| 82 | ``` |
| 83 | |
| 84 | A fenced div need not have attributes or a class name. |
| 85 | |
| 86 | ``` |
| 87 | :::: |
| 88 | Hi |
| 89 | :::: |
| 90 | . |
| 91 | <div> |
| 92 | <p>Hi</p> |
| 93 | </div> |
| 94 | ``` |
| 95 | |
| 96 | The closing fence must be at least as long as the opening fence. |
| 97 | |
| 98 | ``` |
| 99 | ::::::::: foo |
| 100 | Hi |
| 101 | :::: |
| 102 | . |
| 103 | <div class="foo"> |
| 104 | <p>Hi |
| 105 | ::::</p> |
| 106 | </div> |
| 107 | ``` |
| 108 | |
| 109 | If the end of the input (or enclosing block) is encountered |
| 110 | before 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 | ```` |