Spacing rules that matter in VS Code / CommonMark
| Syntax | Rule |
|---|---|
| # Heading 1 | Space required after #. Without it, #Heading is just text. |
| ## Heading 2 | Up to ###### (6 levels). Each needs the space. |
| Blank line before a heading is recommended but not strictly required in CommonMark. | |
| Syntax | Result | Rule |
|---|---|---|
| *italic* or _italic_ | italic | No spaces between markers and text |
| **bold** or __bold__ | bold | No spaces between markers and text |
| ***bold italic*** | bold italic | Combine them |
| ~~strikethrough~~ | No spaces between ~~ and text |
Bad: ** bold ** — spaces inside markers break it
Good: **bold**
| Syntax | Rule |
|---|---|
| - Item or * Item | Space required after - or * |
| 1. Item | Space required after . — number doesn't have to be sequential |
| - [ ] Task | Checkbox (task list). Space inside brackets: [ ] unchecked, [x] checked |
Nested lists: indent 2 or 4 spaces (be consistent). A blank line between items makes "loose" list (extra spacing).
- Parent item
- Child item (2-space indent)
- Grandchild (4-space indent from parent)
| Syntax | Rule |
|---|---|
| [text](url) | No space between ] and ( |
|  | Same as link but with ! prefix |
| [text](url "title") | Optional title in quotes shows on hover |
Bad: [text] (url) — space between bracket and paren breaks it
| Syntax | Rule |
|---|---|
| `inline code` | Single backticks for inline |
```python code here ``` |
Fenced code block. Language tag is optional. The ``` must be on its own line. No spaces before the closing fence. |
| (4-space indent) | Alternative: indent 4 spaces for a code block (no language highlighting) |
| Syntax | Rule |
|---|---|
| > Quote text | Space after > is conventional but not required |
| > Line 1 > Line 2 | Each line needs > for multi-line quotes |
| > > Nested | Nest with additional > |
--- or *** or ___
Three or more. Must be on its own line. Blank line above recommended (otherwise --- under text becomes a heading).
| Header 1 | Header 2 | |----------|----------| | Cell | Cell | | Cell | Cell |
The separator row is required (at least |--|--|).
Alignment: :--| left, :--:| center, |--: right.
Leading/trailing pipes are optional but recommended for readability.
Columns don't need to be aligned in source — VS Code just makes it look nicer.
| What you want | How |
|---|---|
| New paragraph | Blank line between text blocks |
| Line break (soft return) | Two spaces at end of line, then Enter. Or <br> |
| Just pressing Enter once | Does nothing — text continues on same line in rendered output |
This is the #1 gotcha. A single newline in source = no break in output.
# needs a space after it — # Yes not #No- and 1. need a space after them — - Yes not -No** and * must touch the text — **yes** not ** no **[text](url) — no space between ] and (