Markdown Cheatsheet - Markdown Syntax Reference

Markdown is not difficult to write; it is difficult to be sure what it will look like elsewhere. GitHub renders tables and some documentation sites do not; some platforms drop task lists and others strip inline HTML. This sheet places widely supported syntax alongside platform-specific extensions, organised by headings, text styling, lists, code blocks, links and images, and tables with horizontal rules, marking clearly which forms are universal and which only work in some places. The selection rule is consistent: prefer universal syntax, because the small convenience an extension adds becomes rework the moment the document moves. Where an extension is genuinely needed - task lists, autolinks - at least confirm the target supports it and keep a plain-text fallback in mind. Copying a document between a docs site and a repository README is where transformation actually bites, and three spots account for most of it: line breaks inside tables, code blocks that themselves contain fences, and URLs containing special characters.

Reference·31 commands·Last updated 2026-07-21
markdownDocumentationSyntaxREADME

Heading 5

# H1
Level 1 heading, typically for article title
## H2
Level 2 heading
### H3
Level 3 heading, up to ###### H6
Title ===
Setext-style H1 (underline =)
Title ---
Setext-style H2 (underline -)

Text Style 7

**bold**
Bold text
*italic*
Italic text
***bold italic***
Bold italic text
~~strikethrough~~
Strikethrough (GFM extension)
`inline code`
Inline code
> quote
Blockquote
> > nested quote
Nested blockquote

List 5

- Unordered item
Unordered list, also * or +
1. Ordered item
Ordered list, numbers auto-increment
- [ ] Todo
Unchecked task list (GFM)
- [x] Done
Checked task list (GFM)
- Indented sub-item
Indent 2 spaces for sub-list

Code Block 4

```python
Fenced code block with language highlighting
```
Code block closing marker
4-space indent code
Indented code block (not recommended, no language)
```{bash eval=true}
Executable code block (Org-mode / R Markdown)

Table & HR 5

---
Horizontal rule (three or more dashes)
| Col1 | Col2 | | --- | --- | | a | b |
Table, second row defines alignment
| :--- |
Left-aligned column
| :---: |
Center-aligned column
| ---: |
Right-aligned column

Tips

  • Use <br> for line breaks inside tables — Markdown tables don't support native line breaks.
  • When backticks conflict inside code blocks, use more backticks for fencing (e.g., ~~~~ around content containing ```).
  • GFM (GitHub Flavored Markdown) supports task lists, strikethrough, auto-links, and tables — more features than standard Markdown.

FAQ

My Markdown image uses a relative path but breaks after publishing — why?

Relative paths resolve against the Markdown file's own directory, so images under ./images referenced as ![alt](./images/a.png) only render if they are deployed too and the site does not rewrite URLs. In GitHub repos relative paths work but are case-sensitive; for documentation sites on an image CDN, use the full URL instead.

How do I put a pipe or line break inside a Markdown table cell?

Columns are separated by pipes, so escape a literal pipe inside a cell as \|. For a line break use <br>; a natural Markdown line break collapses to a space inside a cell. Keep cells short and prefer blockquotes or lists for heavier layout.

Do I need to specify the language for a Markdown code block?

Wrap code in triple backticks and put the language right after, e.g. ```javascript, for highlighting. Some platforms also accept four-space indented blocks, and single backticks are for inline code. Common identifiers like javascript, typescript, bash, json and python are recognized by most engines.

How do I write long links or reference-style links in Markdown?

Inline is [text](https://...), but long URLs clutter the doc. Reference-style links define [key]: https://... in a link list once and use [text][key] anywhere, so changing one URL updates every reference. Bare URLs are auto-linked on many sites.

Why does my Markdown look fine locally but break on GitHub?

Each platform parses a slightly different dialect. GitHub uses GFM with task lists, autolinks, @mentions and table highlighting, but is stricter about blank lines and indentation and sanitizes some raw HTML. Local previews differ too, especially around line breaks. Stick to portable core syntax (brackets, asterisks, backticks) and preview on the target platform before publishing.

Official References

Each command links to its official documentation below, so you can verify the latest usage and read deeper.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us