Markdown Cheat Sheet: Syntax Everyone Should Know
Markdown is a plain-text formatting language that converts to clean HTML in seconds. Created by John Gruber in 2004, it has become the default way to write documentation, README files, blog posts, and notes across GitHub, VS Code, Notion, and dozens of other tools. This cheat sheet covers the syntax you will actually use, with rendered examples and notes on where GitHub Flavored Markdown (GFM) diverges from the original spec.
Headings and Emphasis
Use the hash character (#) before text to create headings. The number of hashes sets the level, from H1 through H6. Always leave a space between the hash and the text: # Title works; #Title does not in most parsers.
| Markdown | Renders as |
|---|---|
# Page Title | H1 — largest, one per page |
## Section | H2 — main sections |
### Sub-section | H3 — nested topics |
For inline emphasis, wrap text in asterisks or underscores:
*italic*or_italic_renders as italic**bold**or__bold__renders as bold***bold italic***combines both
Asterisks are safer inside words. GFM treats intra-word underscores literally, which is a deliberate improvement over the original spec that prevents accidental formatting in identifiers like some_variable_name.
Lists: Unordered and Ordered
Unordered lists use -, *, or + as bullet markers. Pick one and stay consistent within a list. Ordered lists use numbers followed by a period — the actual numbers do not have to be sequential since most parsers renumber automatically, but starting with 1. is the clearest convention.
Unordered:
- Apples
- Oranges
- Grapes
Ordered:
1. Clone the repo
2. Install dependencies
3. Run the dev server
Nested lists require 2–4 spaces (or one tab) of indentation before the bullet. Mixing ordered and unordered at different nesting levels is valid and renders correctly in all major flavors.
Links and Images
The link syntax is [anchor text](URL). Add a quoted title for a tooltip: [text](URL "Tooltip").
- Inline link:
[UtilityApp](https://utilityapp.lat) - Reference-style: define
[label]: URLelsewhere in the document, then use[text][label] - Auto-link (GFM only): bare URLs like
https://example.comare automatically hyperlinked without any brackets
Images follow the same pattern with a leading exclamation mark: . The alt text is not decorative — screen readers announce it and it appears when the image fails to load. Write descriptive alt text, not just the filename.
Code: Inline and Fenced Blocks
For short snippets inside a sentence, wrap in single backticks: `git status`.
For multi-line code blocks, use three backticks (a fenced code block) on the line before and after the code. Add a language identifier immediately after the opening fence for syntax highlighting:
```javascript
const greet = name => `Hello, ${name}!`;
console.log(greet('World'));
```
Common language identifiers: javascript, python, bash, css, html, json, sql. Fenced code blocks are a GFM extension; the original spec used 4-space indentation instead, which is now largely obsolete. If syntax highlighting matters, always use the fenced form with a language tag.
Tables (GFM Extension)
Tables are a GitHub Flavored Markdown extension not present in original Markdown. They use pipes (|) to separate columns and a row of dashes to define the header boundary. The colon position in the separator row controls column alignment.
| Feature | Basic Markdown | GFM |
|---------------|:--------------:|-------:|
| Tables | No | Yes |
| Auto-links | No | Yes |
| Strikethrough | No | Yes |
| Task lists | No | Yes |
Rendered output:
| Feature | Basic Markdown | GFM |
|---|---|---|
| Tables | No | Yes |
| Auto-links | No | Yes |
| Strikethrough | No | Yes |
| Task lists | No | Yes |
Alignment: :--- = left, :---: = center, ---: = right. Pipes at the very start and end of each row are optional but improve readability. Tables do not support multi-line cell content — keep each cell on one line.
GFM Extras: Strikethrough, Task Lists, and Blockquotes
GFM adds several features that have become de facto standard across most modern tools:
- Strikethrough:
~~deleted text~~renders as struck-through text — useful in changelogs and edits - Task lists:
- [ ] Todoand- [x] Donerender as checkboxes in GitHub issues, pull requests, and many note-taking apps - Blockquotes: prefix lines with
>— works in all flavors and is useful for callouts, warnings, or pulled quotes - Horizontal rules: three or more dashes (
---), asterisks (***), or underscores (___) on their own line - Footnotes (supported by some renderers):
[^1]inline, defined as[^1]: Note textat the bottom of the document
One critical GFM behavior to remember: line breaks. A single newline is ignored in both standard Markdown and GFM — you need two trailing spaces at the end of a line or a blank line to force a break. Always use a blank line between paragraphs for portable, predictable output across all renderers.
Convert Markdown to HTML Instantly
Writing Markdown is fast; verifying what it renders to HTML is where people slow down. A dedicated converter lets you paste your Markdown and see the exact HTML output immediately — useful when you need to embed content in a CMS, audit the generated markup for accessibility, or debug a rendering quirk between flavors.
The Markdown to HTML tool on UtilityApp handles standard Markdown and GFM extensions: tables, fenced code blocks with language hints, strikethrough, and auto-linked URLs. Paste your source, get clean HTML — no account required, no data stored.
Common use cases:
- Copying README content into a static site's HTML template
- Checking that a complex table or nested list renders the way you expect before committing
- Extracting clean HTML from Markdown documentation for email newsletters
- Debugging why a specific syntax does not render correctly in a target platform
常见问题
What is the difference between Markdown and GitHub Flavored Markdown (GFM)?+
Standard Markdown covers headings, emphasis, links, images, blockquotes, code, and lists. GFM extends it with tables, fenced code blocks with language IDs, strikethrough, task-list checkboxes, and auto-linking of bare URLs. Most modern tools — VS Code, Notion, GitLab, and many static site generators — support GFM or a close superset.
Why does my Markdown table not render correctly?+
The most common causes are a missing separator row (the row of dashes between the header and body), unequal column counts across rows, or using a renderer that does not support GFM tables. Make sure every row has the same number of pipe-separated columns and that your platform explicitly supports table syntax.
How do I add a line break inside a paragraph without starting a new paragraph?+
End the line with two or more spaces before pressing Enter. This produces a line break in the HTML output. A blank line between two lines creates a full paragraph break. The two-trailing-space rule is part of the original spec and supported universally, though trailing spaces are invisible in most editors.
Can I mix raw HTML inside a Markdown file?+
Yes — standard Markdown allows inline HTML and most parsers pass it through untouched. This is useful for elements Markdown cannot express natively, such as definition lists or custom attributes. GFM sanitizes raw HTML in certain contexts like GitHub comments to prevent XSS, so behavior depends on the rendering environment.
Is there a way to escape Markdown syntax so it renders literally?+
Prefix any special character with a backslash to escape it. For example, \*this\* renders as *this* instead of italic text. Characters that can be escaped include backslash, backtick, asterisk, underscore, curly braces, square brackets, parentheses, hash, plus, minus, period, and exclamation mark.