Markdown Syntax Cheat Sheet
A quick reference for core Markdown syntax including headings, emphasis, lists, links, images, tables, and code blocks.
Headings & Emphasis
Basic text formatting syntax.
# H1 heading## H2 heading### H3 heading*italic* or _italic_**bold** or __bold__***bold italic***~~strikethrough~~> Blockquote text---(horizontal rule)
Lists
Ordered, unordered, and nested lists.
- Item one- Item two - Nested item1. First step2. Second step 1. Sub-step- [ ] Unchecked task- [x] Checked task
Links & Images
Inserting hyperlinks and images.
[Link text](https://example.com "optional title")[Reference link][1][1]: https://example.com "Reference title"
Code & Tables
Inline code, fenced blocks, and table syntax.
Inline `code` with backticks```pythondef hello(): print("Hi")```| Name | Age | City ||-------|:---:|---------:|| Alice | 30 | New York || Bob | 25 | Boston |
GitHub Flavored Markdown Extras
Common extensions supported on GitHub and most renderers.
- Autolinks- Bare URLs like https://example.com become clickable automatically
- Task lists- `- [ ]` and `- [x]` render as interactive checkboxes
- Tables- Pipe-delimited tables with optional `:---:` alignment markers
- Fenced code with language- ```` ```js ```` enables syntax highlighting for that language
- Footnotes- `Text[^1]` with `[^1]: Footnote text` at the bottom (GFM/many renderers)
- Escaping characters- Prefix with `\` (e.g. `\*not italic\*`) to show literal Markdown symbols
YAML Front Matter
Embedding document metadata that static site generators (Jekyll, Hugo, Next.js MDX loaders) parse before rendering the body.
---title: "Deploying with Docker"date: 2026-02-10tags: [devops, docker]draft: false---# Deploying with DockerThe front matter block must be the very first thing in thefile (line 1, no leading blank lines) and is delimited bytriple-dashed lines. Everything between them is parsed asYAML, not rendered as Markdown.
Definition Lists & Abbreviations
Non-standard but widely supported extensions (PHP Markdown Extra, Pandoc) for glossary-style content.
Term: First definition of the term.: A second definition, if needed.Another Term: Definition that can span multiple indented lines.*[HTML]: HyperText Markup Language*[CSS]: Cascading Style SheetsThe HTML and CSS abbreviations above render with a<abbr> tooltip wherever they appear in the document.
Math Expressions (LaTeX)
Inline and block math delimiters supported by KaTeX/MathJax-enabled renderers (GitHub, many docs tools).
Inline math: the quadratic formula is $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$.Block math:$$\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$$Note: single `$...$` is inline, double `$$...$$` is acentered display block on its own line.
Mermaid Diagrams in Fenced Blocks
A ```mermaid fenced block renders as an SVG diagram on GitHub, GitLab, and most docs platforms instead of a code block.
```mermaidflowchart LR A[Client] --> B{Auth OK?} B -- yes --> C[API] B -- no --> D[401 response] C --> E[(Database)]```
CommonMark Parsing Gotchas
Edge cases where Markdown renders differently than a beginner would expect.
- Loose vs tight lists- A blank line between list items forces `<li><p>` wrapping (loose list); no blank line keeps items tight/inline
- Lazy continuation- A paragraph line following a list item without indentation still belongs to that item unless it's blank
- Setext headings- A line of `===` under text makes an H1, `---` makes an H2 — but `---` alone can also be a horizontal rule or YAML fence, so context matters
- Backslash escapes- Only ASCII punctuation is escapable with `\`; `\a` renders literally as `\a`, not `a`
- HTML block interruption- Raw HTML block-level tags (`<div>`, `<table>`) suspend Markdown parsing inside them unless separated by a blank line
- Emphasis flanking rules- `a**b**c` and `a_b_c` behave differently: `_` requires word boundaries, `*` does not
When a line needs a hard line break without starting a new paragraph, end it with two trailing spaces (or use a backslash `\` in most flavors) rather than an empty blank line.