Markdown guide · Code, tables, diagrams & math

Code blocks

Put ``` on the lines before and after a block of code.

For several lines of code, put three backticks on a line before and after it. Nothing inside is formatted, and spacing is kept exactly.

You type
```
function greet(name) {
  return `Hello, ${name}!`;
}
```
You get
function greet(name) {
  return `Hello, ${name}!`;
}

Name the language after the opening backticks. Apps that color code use it, and it tells readers what they're looking at.

You type
```python
for item in basket:
    print(item)
```
You get
for item in basket:
    print(item)
  • Common names: js, ts, python, csharp, java, json, html, css, sql, bash, powershell, yaml.
  • Three tildes (~~~) work in place of backticks. That's handy when the code itself contains ```.
  • Lines indented by four spaces are also a code block. Fences are clearer, so prefer those.
Tip In Styled Mode, click the language label on a code block to change it. The CB button on the toolbar inserts a new block. A language of mermaid makes a diagram.
Write Markdown without memorizing it.

Prosedown shows your document styled as you type, with the Markdown one click away. This guide is built in: press F1.

Try it free for 14 days