Code blocks
Syntax highlighting for 46 languages, plus copy, wrap, and captions.
Insert a code block with /code or Ctrl + Alt + C. Typing three backticks
(```) works too.
Choosing a language#
Click the language name in the top-left corner of the block. A picker opens:
- Type to search.
- Move with
↑and↓, choose withEnter. Esccloses it.
46 languages are supported: Python, JavaScript, TypeScript, Go, Rust, Java, C, C++, C#, PHP, Ruby, Swift, Kotlin, SQL, Bash, PowerShell, HTML, CSS, JSON, YAML, Dockerfile, LaTeX, and more. Plain Text turns highlighting off.
Colours update immediately when you switch language.
Copying#
The copy button in the top right puts the whole block on the clipboard. It briefly turns into a checkmark to confirm.
More options#
Under the three-dot button:
- Wrap code — long lines fold onto the next line instead of scrolling sideways.
- Add caption — a line of explanatory text under the block. Use the same menu to remove it again.
Both settings are saved with the note.
Typing inside a code block#
Tabindents,Shift+Taboutdents.Enterstarts a new line rather than leaving the block.- Pressing
Enteragain on an empty last line exits the block into a normal paragraph. Backspaceat the very start turns the code block back into plain text.- Anything pasted into a code block arrives as plain text, with formatting stripped.
Undo#
Inside a code block, Ctrl + Z and Ctrl + Shift + Z work on that block's
own history, so undo only affects that piece of code.