Inline code
Wrap short snippets in single backticks: `` `const x = 1` ``. Everything inside is literal — asterisks, underscores and angle brackets are not interpreted. This is how you mention a variable, a command name or a filename in a sentence.
Fenced code blocks
For anything multi-line, put triple backticks on their own line before and after the code. Add a language identifier immediately after the opening fence to get syntax highlighting: `````js```, `````python```, `````bash```, `````json```, `````html``` and so on. GitHub-Flavoured Markdown and most editors support these.
Escaping and nested backticks
If your code contains backticks, use more backticks on the fence than the longest run inside it — for example four backticks around a snippet that contains three. Inside a list item, indent the fence to the item's content level so it stays associated with that item.
Common mistakes
- Forgetting the blank line before a fence inside a list
- Using a language tag no highlighter knows — harmless, it just renders plain
- Mixing tabs and spaces for indentation so a fenced block is read as an indented code block
- Not closing the fence, which swallows the rest of the document as code