Markdown Theme Break Examples (horizontal rules)

Using Pegdown and Pandoc

Doug Hemken

May 2018

A theme break (a horizontal rule) is written as three or more dashes, underscores, or asterisks. These may be preceded by up to three spaces. (When rendered with pegdown or pandoc they usually must be preceded by a blank line, and followed by a blank line.)

This is a block element that cannot contain inline elements.

Written as:

---
___
***

Rendered as:




Too few marks do not work:

--

__

**

The marks may be interspersed with spaces, but not any other characters.

Written:

- - -

_ _ _

* * *



Theme breaks and headers

A theme break may appear before or after a header with the usual blank lines.

#### Header 4

---

#### Another header

Header 2
---

---

Header 2 again
---

Header 4


Another header

Header 2


Header 2 again

Theme breaks and paragraphs

Theme breaks do not interrupt paragraphs (dashes may be interpreted as setext headings). A blank line is required.

Some text.
---

More text.
___

Yet more.
***

Some text.

More text. ___

Yet more. ***

Theme breaks and code blocks

A theme break may appear before or after a fenced code block or an indented code block, with the usual blank lines.

~~~
generate y = x
~~~

***

~~~
summarize y
~~~

    generate y = x
    
***

    summarize y
generate y = x

summarize y
generate y = x

summarize y

Theme breaks and tables

A theme break requires a blank line before or after a table.

***

column 1 | column 2
---------|---------
value 1  | value 2

---

column 1 column 2
value 1 value 2

Theme breaks and block quotes

A theme break may appear before a block quote with a blank line. After a block quote a blank line is required (because block quotes have lazy continuation).

> Quoted text.

---

> More quotes.

Quoted text.


More quotes.

A theme break may appear within a block quote in pegdown, with quoted blank lines, but not in pandoc.

Written:

> ***
>
> quoted
>
> ***
> 
> text

Rendered:


quoted


text

Theme breaks and lists

A theme break may appear before or after a list with blank lines.

- list 1

---

- list 2
  • list 1

  • list 2

A theme break may be contained in a list, if it is composed of characters that contrast with the list item marker. Notice using the same character as a list item and as a theme break yields a pure theme break, interrupting the list.

Written:

- item 1, list 1

- ***
  
- ---

- ___

- item 2, list 2
* ***

Rendered:

  • item 1, list 1




  • item 2, list 2 * ***