On this page

4Leaf blocks

This section describes the different kinds of leaf block that make up a Markdown document.

4.1Thematic breaks

A line consisting of optionally up to three spaces of indentation, followed by a sequence of three or more matching -, _, or * characters, each followed optionally by any number of spaces or tabs, forms a thematic break.

***
---
___
<hr />
<hr />
<hr />

Wrong characters:

+++
<p>+++</p>
===
<p>===</p>

Not enough characters:

--
**
__
<p>--
**
__</p>

Up to three spaces of indentation are allowed:

 ***
  ***
   ***
<hr />
<hr />
<hr />

Four spaces of indentation is too many:

    ***
<pre><code>***
</code></pre>
Foo
    ***
<p>Foo
***</p>

More than three characters may be used:

_____________________________________
<hr />

Spaces and tabs are allowed between the characters:

 - - -
<hr />
 **  * ** * ** * **
<hr />
-     -      -      -
<hr />

Spaces and tabs are allowed at the end:

- - - -    
<hr />

However, no other characters may occur in the line:

_ _ _ _ a

a------

---a---
<p>_ _ _ _ a</p>
<p>a------</p>
<p>---a---</p>

It is required that all of the characters other than spaces or tabs be the same. So, this is not a thematic break:

 *-*
<p><em>-</em></p>

Thematic breaks do not need blank lines before or after:

- foo
***
- bar
<ul>
<li>foo</li>
</ul>
<hr />
<ul>
<li>bar</li>
</ul>

Thematic breaks can interrupt a paragraph:

Foo
***
bar
<p>Foo</p>
<hr />
<p>bar</p>

If a line of dashes that meets the above conditions for being a thematic break could also be interpreted as the underline of a setext heading, the interpretation as a setext heading takes precedence. Thus, for example, this is a setext heading, not a paragraph followed by a thematic break:

Foo
---
bar
<h2>Foo</h2>
<p>bar</p>

When both a thematic break and a list item are possible interpretations of a line, the thematic break takes precedence:

* Foo
* * *
* Bar
<ul>
<li>Foo</li>
</ul>
<hr />
<ul>
<li>Bar</li>
</ul>

If you want a thematic break in a list item, use a different bullet:

- Foo
- * * *
<ul>
<li>Foo</li>
<li>
<hr />
</li>
</ul>