Skip to content

Code Blocks

FoldNotes supports fenced code blocks for displaying code, configuration files, or any preformatted text.

Syntax

Wrap code in triple backticks. Optionally specify a language for syntax highlighting in the preview:

```python
def hello():
    print("Hello, world!")
```

Editor Behaviour

Code blocks in the editor:

  • Use a monospace font for all content between the fences
  • Show a subtle background highlight to visually group the block
  • Disable spell checking inside the block
  • Preserve indentation exactly as typed (no auto-indent or list continuation)
  • Support folding — click the fold arrow on the opening fence to collapse the entire block

Pasting into Code Blocks

When you paste text inside a code block, FoldNotes inserts it as plain text — no Markdown conversion is applied. This preserves code indentation and prevents formatting interference.

Inline Code

For short code snippets within a paragraph, use single backticks:

Use the `fn daily append` command to add text.

This renders in a monospace font with a subtle background.

Syntax Highlighting

Syntax highlighting is available in the Preview window (Cmd+Shift+P) via Highlight.js. Specify the language after the opening fence:

```swift
let greeting = "Hello"
print(greeting)
```

The editor itself uses monospace styling for all code block content regardless of language.

Drag and Drop

Code blocks can be dragged as a unit. Grab the drag handle on the opening fence line to move the entire block (including content and closing fence) to a new position. See Drag & Drop for more on moving content around your note.