MOMO SYNTAX GUIDECommonMark & GFM Reference

Markdown Horizontal Line: Syntax & Live Tester

Write clean thematic breaks with ---, ***, or ___ — and catch the Setext H2 heading trap instantly.

Adding a Markdown horizontal line takes just three characters on a standalone line, yet tiny whitespace mistakes turn --- into an accidental H2 heading or break YAML frontmatter. Test every horizontal rule variant live below before committing your .md file.

1 valid <hr> horizontal line rendered cleanly
Markdown Source (Editable)Setext Trap Detector
Rendered HTML OutputCommonMark 0.31

THE 3 STANDARD HORIZONTAL RULE SYNTAXES

Every valid way to write a Markdown horizontal line

The CommonMark specification calls a Markdown horizontal line a thematic break. Any line containing three or more matching hyphens, asterisks, or underscores — optionally separated by spaces or tabs, with up to three leading spaces — compiles to an identical <hr> element across GitHub, VS Code, Obsidian, Hugo, and Momo.

Syntax Example Spacing Rules Setext H2 Risk Best Use Case
Three Hyphens --- Requires blank line above High (if no blank line) Default standard in GitHub READMEs and team style guides
Three Asterisks *** Works with or without blank line None Safest choice in dense notes, specs, and AI-generated drafts
Three Underscores ___ Blank line recommended None Markdown files using YAML frontmatter or bold ** markers
Spaced Characters - - - or * * * Spaces or tabs allowed between marks None Classic editorial prose and print-style scene breaks
Raw HTML Tag <hr> or <hr /> Inline or standalone block None Inside complex HTML tables or custom divs where Markdown stops
  • Exact CommonMark rule

    You can write three characters or thirty (--- and ---------- render identically), and you can place spaces between them (* * *). However, you cannot mix symbols on the same line: -*- is rendered as literal text, not a horizontal rule, and four leading spaces turns the line into an indented code block instead of a divider.

  • Prettier & linter conventions

    Most automated formatters — including Prettier, markdownlint (MD035), and remark — normalize every horizontal rule markdown divider to --- surrounded by blank lines. If your repository enforces markdownlint in CI, pick one style across the whole repo and keep blank lines around every divider so automated checks pass quietly.

  • Using dividers inside lists & blockquotes

    Inside a blockquote, prefix the divider with > --- on its own quoted line. Inside a list item, avoid placing --- at the exact same column as bullet hyphens — indent it or use *** so the parser does not confuse your thematic break with a nested bullet point.

COMMON BUGS & EDGE CASES

Why your Markdown horizontal line broke (and how to fix it)

Almost every broken Markdown horizontal line in pull requests, documentation sites, and Claude Code output comes from one of three parser edge cases. Knowing them saves minutes of confusing visual diffs.

  1. 1. The Setext H2 heading trap

    Original Markdown allowed underlining a heading with === for H1 and --- for H2. That legacy rule is still active in CommonMark today. Whenever you type a paragraph and put --- on the very next line without an empty line in between, the entire paragraph becomes a giant <h2> heading and no horizontal line appears. Click See Setext H2 Trap in the live tester above to watch it happen — then fix it by adding one blank line above --- or switching to ***.

  2. 2. YAML frontmatter collisions

    Static site generators like Hugo, Astro, Next.js MDX, and Jekyll treat --- on line 1 as the opening fence of YAML metadata. If you start a document with a horizontal line before any text, your site generator may try to parse the opening paragraph as YAML and throw a build error. Never start a file on line 1 with --- unless it is real frontmatter; use *** if you genuinely want a top divider.

  3. 3. Slide decks & AI-generated specs

    Tools like Marp, Slidev, and Reveal.js hijack --- as a slide separator, which means a casual thematic break splits your deck into an empty slide. Meanwhile, coding agents like Claude Code and Codex frequently insert --- between architecture sections; opening those project folders in a native Mac Markdown editor like Momo lets you inspect rendered breaks, edit plain .md files directly, and verify layout before publishing.

NATIVE MACOS MARKDOWN WORKFLOW

Read and edit clean Markdown locally in Momo

Online syntax testers are handy for quick checks, but real specs, READMEs, and AI-generated runbooks live inside local folders on your Mac. Momo is a native Swift + AppKit Markdown editor that opens 15,000-file folders in 0.65 seconds, keeps every file as plain .md on disk, and renders horizontal lines, Markdown tables, interactive checkboxes, and Mermaid diagrams cleanly without Electron lag.

0.65s Cold start on 15,000 .md files
1.3ms Keystroke latency in native AppKit
100% Plain .md on disk — zero lock-in
  • GitHub, GitLab & Bitbucket support

    Every major Git host follows CommonMark 0.31 for thematic breaks. Whether you write ---, ***, or ___ in a pull request description, README, or wiki page, GitHub renders a crisp full-width horizontal rule that adapts automatically to light and dark GitHub themes.

  • Obsidian, Notion & static site generators

    Obsidian, Notion’s Markdown importer, Astro, Hugo, and Docusaurus all convert standalone --- and *** lines into horizontal dividers. Just remember to keep a blank line above --- inside Markdown editors so live preview parsers never promote the preceding sentence into an H2 heading.

  • Keyboard shortcuts & fast drafting

    When structuring long technical specifications, pairing clean --- section dividers with clear H2 headings makes 500-line AI-generated architecture docs dramatically easier to scan in a native Mac Markdown reader.

FAQ

Markdown horizontal line — common questions

Quick reference answers for GitHub, Obsidian, static sites, and macOS Markdown editors.

How do you insert a horizontal line in Markdown?

Place three or more hyphens (---), asterisks (***), or underscores (___) on a line by themselves with blank lines above and below. Every CommonMark and GitHub Flavored Markdown parser turns all three into a standard HTML <hr> element.

Why did --- turn my text into a giant heading instead of a horizontal line?

Without a blank line above it, --- triggers Setext H2 heading syntax in CommonMark, turning the previous paragraph into an <h2>. Always leave an empty line above ---, or use *** which never triggers Setext headings.

Which is better: ---, ***, or ___ for a Markdown divider?

Use --- with blank lines if your repository uses Prettier or markdownlint defaults. Use *** if you write quickly in dense notes and want total immunity from accidental Setext H2 headings or YAML frontmatter conflicts.

Can I style a Markdown horizontal line to be thicker or colored?

Plain Markdown intentionally keeps presentation separate from content, so --- only emits semantic <hr>. Its thickness, margin, and color come from your website CSS or your local Markdown reader theme.