Markdown Cheat Sheet: Common Syntax With Examples
Markdown uses plain symbols for formatting: # for a heading, ** for bold, - for a list item. The tables below show what you type and what you get for each common element. Copy any example into a .md file to try it.
New to the format? Read what a Markdown file is and how to open one first.
Drag in a .md file and read it properly. One HTML file, nothing to install, works offline, with themes and dyslexia-friendly reading.
Headings
Start the line with one to six # signs, then a space.
| You type | You get |
|---|---|
# Page title | A level 1 heading, the largest |
## Section | A level 2 heading |
### Sub-section | A level 3 heading |
###### Small print | A level 6 heading, the smallest |
Use one level 1 heading per document, for the title.
Bold, italics and strikethrough
| You type | You get |
|---|---|
**bold text** | bold text |
*italic text* | italic text |
_italic text_ | italic text |
***bold and italic*** | bold and italic |
~~crossed out~~ | The words with a line through them |
Paragraphs and line breaks
Leave a blank line between two paragraphs. A single line break in your text does not start a new line in the result. To force a new line inside a paragraph, end the line with two spaces or a backslash.
Lists
Start each line with a hyphen and a space for bullets. Start it with a number and a period for a numbered list.
- Milk - Eggs - Free range - Large 1. Open the file 2. Change the text 3. Save it
You get a bullet list with two items nested under Eggs, then a numbered list. Indent a line by two to four spaces to nest it under the item above. An asterisk or a plus sign works in place of the hyphen.
Links and images
| You type | You get |
|---|---|
[Example site](https://example.com) | The words "Example site" as a link |
<https://example.com> | The address itself as a link |
[Install steps](docs/install.md) | A link to another file in the same project |
 | The picture. "A red bike" is the alt text. |
An image is a link with an exclamation mark in front. The picture stays in its own file, so keep it in the place the path points to.
Code
Wrap a short piece of code in single backticks. For a block of code, put three backticks on the line before it and three on the line after.
| You type | You get |
|---|---|
Run `npm install` first. | Run npm install first. |
```python total = price * 2 print(total) ```
You get the two lines in a code box, in a fixed-width font, with spacing kept as typed. The word after the first three backticks names the language. Many readers use it to colour the code. Symbols inside code are shown as they are, so ** stays two asterisks.
Quotes
Start the line with a greater-than sign.
| You type | You get |
|---|---|
> Measure twice, cut once. | The sentence as an indented quote block |
>> A reply inside the quote | A quote nested inside a quote |
Tables
Use pipes between columns. The second line, made of hyphens, separates the header row from the rest.
| Tool | Price | Works offline | |---------|------:|:-------------:| | Reader | 0 | Yes | | Editor | 12 | No |
You get a table with a header row and two data rows. A colon in the hyphen line sets the alignment:
| You type in the hyphen line | You get |
|---|---|
:--- | Column aligned left |
---: | Column aligned right |
:---: | Column centred |
The pipes do not need to line up in the raw text. Lining them up only makes the file easier to read.
Task lists
- [x] Write the draft - [ ] Check the links - [ ] Publish
You get a list with checkboxes. The first box is ticked and the other two are empty. Type the brackets with a space between them for an empty box.
Lines and special characters
| You type | You get |
|---|---|
--- on its own line | A horizontal line across the page |
\*not italic\* | *not italic*, with the asterisks showing |
\# Not a heading | # Not a heading, as normal text |
AT&T | AT&T |
<div> | <div> as text you can read |
A backslash in front of a symbol tells Markdown to show the symbol and not act on it. Markdown also accepts raw HTML. To show a tag as text, wrap it in backticks or write < and > for the angle brackets.
What works where
Headings, bold, italics, lists, links, images, code and quotes work in every Markdown tool. Tables, task lists and strikethrough come from an extension called GitHub Flavored Markdown. Most current tools support it, but a few older ones do not.
The safe habit is to check the rendered view before you send a file. Super Markdown shows a rendered file in the browser, and in Edge and Chrome it reloads on its own when the file changes. Keep it open next to your editor to see each change as you save.
Mistakes that break the formatting
- No space after the symbol.
#Titleis not a heading in most tools.# Titleis. - No blank line before a list or a table. Some tools then treat it as part of the paragraph above.
- Mixed indents in a nested list. Pick two or four spaces and keep to it.
- A missing closing mark. One lone
**or backtick can change the rest of the paragraph. - Spaces in a link address. Write
%20for each space, or wrap the address in angle brackets.
Drag in a .md file and read it properly. One HTML file, nothing to install, works offline, with themes and dyslexia-friendly reading.
Comments