Three ways to write it
All three give the same line. Spaces between the characters are allowed, and more than three is fine.
You write
---
***
___
- - -You see
The trap: dashes under text make a heading
Three dashes straight under a line of text, with no empty line between, turn that text into a heading instead of drawing a line.
You write
This becomes a heading
---You see
This becomes a heading
Always leave an empty line before ---. Or use ***, which never makes a
heading.
The other trap: dashes at the top of a file
Three dashes on the very first line start a frontmatter block in many apps,
GitHub and MarkdownPaper included, and the lines after it are hidden until
the next ---. Do not start a file with a horizontal line. See
Markdown frontmatter.
A line with text in the middle
Markdown cannot put text inside the line. Use a short heading instead, or a line, a bold word and another line.
Common problems
- Text became a heading. There is no empty line between the text and
---. - The line does not show. There are fewer than three characters, or other text is on the same line.
- The top of the file disappeared. It starts with
---and was read as frontmatter.
Questions
How do I add a horizontal line in Markdown?
Put --- on a line by itself, with an empty line above and below it.
What is the difference between ---, *** and ___?
None on the page. *** is safest, because it cannot turn the line above into
a heading.
Can I change the thickness or color of the line?
Not in Markdown. The app reading the file decides how the line looks.
Next
- Markdown headings, the other way to divide a document.
- Print a document with its dividers as a clean PDF.