Markdown Block vs Inline Precedence
Last updated: 2026-10-14
Block vs Inline Precedence CommonMark core
Markdown parses blocks first (headings, lists, quotes, fences), then inline content inside them. Blocks interrupt everything: a # at line start is a heading, whatever came before.
| Group | Edge Cases & Rules |
|---|---|
| Spec level | CommonMark core |
| Spec version | CommonMark 0.31.2 + GFM |
📝 Syntax
Parse order: blocks first, then inline
▶ Live Example
Edit Markdown on the left, see the result on the right
💡 Key points
ℹ️ Note This explains a lot: # inside inline code is not a heading; an indented # inside a list item is a list heading.
💡 Tip When syntax 'does not work', first check whether a block swallowed it.
❓ FAQ
Q Can a list item hold a heading?
A Yes — indent the # to the item's content level for a heading inside the item.
Q Can inline code contain block syntax?
A No — inline code is fully literal; # is just a hash.
Q Why can quotes contain anything?
A A quote is a block container; its content is parsed as blocks again.