Guide › Writing

Code blocks

Inline code

Wrap a word or a command in single backticks and it is set in the code font. The slash menu's Inline Code, found with /inline, writes the pair of backticks for you. Emoji names inside code stay text.

Code blocks

For a block of code, put three backticks on a line of their own, the code on the lines below, and three more backticks on a line after it. The slash menu's Code Block, found with /code, writes both lines for you, with the cursor between them.

The block sits on one panel the width of the note, and long lines wrap inside it. With Hide Markdown syntax on, the backticks are hidden; put the cursor on a fence line to see them again.

Code coloring

Write the language's name right after the first three backticks, and Smolpad colors the keywords, strings, comments and numbers. Nine languages are colored:

LanguageName to write
Swiftswift
JavaScriptjavascript or js
TypeScripttypescript or ts
Pythonpython or py
JSONjson
Shellshell, sh, bash or zsh
HTMLhtml, xml or svg
CSScss
Markdownmarkdown or md

A block in any other language, or with no name, stays plain. The colors come from your editor theme. With Hide Markdown syntax on, the language name stays as a small label at the top of the block.

Copy a block

Every closed code block has a Copy button at its bottom right corner. Press it and the code is on the clipboard, without the backticks or the language name. The button reads Copied for a moment, and the cursor stays where it was.

The code font

Code is set in its own font. Choose it in Settings › Editor › Code font: Match Editor Font, System Mono, Atkinson Hyperlegible Mono, JetBrains Mono or Fira Code. See Fonts and text size.

Still stuck? Contact support.