Markdown · <code>`code`</code>
Code
Backticks mark inline code; triple backticks create fenced blocks with optional language info.
Key facts
| Inline | <code>`code`</code> |
|---|---|
| Fence | Three or more backticks or tildes |
| Language | Text after the opening fence |
| Indented | Four spaces, no language hint |
| Nesting | Use more backticks than the content |
| Standard | CommonMark §4.4, §4.5 |
Inline spans
A pair of backticks marks a span where Markdown syntax is inert. To include a literal backtick, use a longer run of backticks around the content. A single backtick inside double backticks renders correctly, and the spaces at the edges are trimmed when both sides have one.
Inline code does not support language highlighting or line breaks. For anything longer than a phrase, a fenced block is clearer and preserves formatting.
Fenced blocks
Three or more backticks open a fence, and the same number closes it. Text after the opening fence is an info string, usually a language name, which highlighter uses to colour the code. The closing fence must be at least as long as the opening one.
Indented code blocks still work but cannot carry a language and are easy to break with list indentation. Prefer fences in modern documents. Inside a fence, every character is literal, including Markdown punctuation.
Frequently asked questions
How do I show triple backticks inside a code block?
Open and close the outer fence with four backticks, then include three inside.
Does the language name affect rendering?
It selects syntax highlighting in renderers that support it. Without it, the block is still valid code.