Fenced divs are containers for sequences of blocks, to which an attribute can be attached. A fenced div begins with an opening fence: a line with three or more consecutive `:` characters, followed optionally by a class name and optionally whitespace. It ends with a closing fence: a line beginning with three or more consecutive `:` characters, followed by optional whitespace and the end of the line. The number of `:` characters in the closing fence must be at least the number in the opening fence. If the end of the input (or enclosing block) is encountered before a closing fence, the fenced div is implicitly closed. ``` :::::::::: foo Hi > A block quote. ::::::::::: .

Hi

A block quote.

``` ``` {#bar .foo} ::: Hi > A block quote. ::::::::::::: .

Hi

A block quote.

``` Fenced divs may be nested. ``` {#bar .foo} :::: Hi ::: baz > A block quote. ::: :::: .

Hi

A block quote.

``` A fenced div cannot interrupt a paragraph, without an intervening blank line. ``` Paragraph text :::: Hi :::: .

Paragraph text :::: Hi ::::

``` A fenced div need not have attributes or a class name. ``` :::: Hi :::: .

Hi

``` The closing fence must be at least as long as the opening fence. ``` ::::::::: foo Hi :::: .

Hi ::::

``` If the end of the input (or enclosing block) is encountered before a closing fence, the fenced div is implicitly closed. ``` > :::: foo > Hi .

Hi

``` ```` ::: outer ``` ::: ``` ::: .
:::
````