Cairn / Docs / Notes Editor

Notes Editor

A CodeMirror-based markdown editor with a formatting toolbar, inline selection preview, and a full read mode renderer. Every note is saved as a plain .md file — readable outside Cairn forever.

Write and Read modes

The editor has two modes, toggled from the header bar:

The editor state is preserved when switching modes — your cursor position, undo history, and unsaved content are kept in memory throughout.

Release Notes.md — Write mode
Write
Read
Spawn tasks
v0.9.1 Release Notes
release docs
# v0.9.1 Release Notes
 
## What's new
 
The formatting toolbar ships with **twelve actions** across four groups. Press `⌘B` or click to toggle.
 
Colour swatches render inline: `#7c6af7` appears with a dot in read mode.
 
Highlighted text uses ==double equals== syntax.
Preview ✕ Esc
The formatting toolbar ships with twelve actions across four groups. Press ⌘B or click to toggle.

Formatting toolbar

The toolbar is always visible in Write mode, docked between the title and the editor. It is hidden in Read mode. All actions support toggling — pressing a button a second time removes the formatting.

Inline formatting

These actions wrap the current selection. If nothing is selected, a placeholder is inserted and selected so you can type immediately.

ButtonMarkdownResult
Bold**text**Bold text
Italic_text_Italic text
Strikethrough~~text~~~~crossed out~~
Highlight==text==Yellow highlight in read mode
Inline code`text`Monospace code span
Link[text](url)Clickable link

Headings

Heading buttons toggle the prefix on the current line (or all selected lines). Switching from H2 to H1 replaces the prefix — it does not accumulate ## marks.

ButtonMarkdownNotes
H1# HeadingAlso generated in the table of contents
H2## HeadingAppears in the table of contents
H3### HeadingAppears in the table of contents

Lists and blocks

These actions operate on the cursor line or every line in the selection. They toggle — pressing again removes the prefix. Numbered list items re-number automatically when toggled on.

ButtonMarkdownNotes
Blockquote> textRenders as an indented callout
Bullet list- itemToggle strips conflicting list prefixes
Numbered list1. itemToggle detected on any number, not just 1.
Task list- [ ] itemRenders as an interactive checkbox in read mode

Block inserts

ButtonBehaviour
Code blockWraps the selection (or inserts a placeholder) in a fenced ``` block. Pressing again when the cursor is inside a fence removes the fence and restores the inner content.
DividerInserts a --- horizontal rule after the current line.

Inline selection preview

When you select text in the editor, a preview panel appears at the bottom of the editor pane. It renders the selection through the full markdown pipeline — including math, callouts, and code highlighting — so you can see exactly what will appear in read mode before you switch.

Keyboard shortcuts

Read mode

Switch to Read mode using the toggle in the header bar or pressing ⌘R. The full renderer activates with all extensions enabled.

Release Notes.md — Read mode
Write
Read
v0.9.1 Release Notes
What's new

The formatting toolbar ships with twelve actions across four groups.

Colour swatches render inline for hex and RGB values: #7c6af7 and rgb(62,207,142).

Highlighted text renders with a yellow background: important callout.

Blockquotes indent and italicise the text for emphasis.
Formatting toolbar
Screenshot docs
npm run compile
npx tsc --noEmit

Colour swatches

In read mode, inline code spans that contain a recognised colour value automatically render a small filled circle next to the value. Supported formats:

Swatches appear in both the inline selection preview and the full read-mode renderer.

Table of contents

Read mode generates a floating table of contents from all H1, H2, and H3 headings in the document. It appears to the right of the content column on wide viewports, and hides automatically when the viewport is too narrow to fit it without overlapping the text.

Full markdown syntax reference

Cairn supports standard GitHub-flavored Markdown plus several extensions.

Text formatting

SyntaxResult
**bold**Bold
_italic_ or *italic*Italic
~~strikethrough~~Strikethrough
==highlight==Yellow highlight
`inline code`Monospace code span (colour swatches for hex/rgb values)
[text](url)Hyperlink — external links open in system browser

Headings

SyntaxNotes
# H1Appears in table of contents
## H2Appears in table of contents
### H3Appears in table of contents
#### H4###### H6Rendered but not in TOC

Lists

SyntaxResult
- item or * itemBullet list
1. itemNumbered list
- [ ] itemUnchecked task checkbox
- [x] itemChecked task checkbox

Blocks

SyntaxResult
> textBlockquote
```language … ```Fenced code block with syntax highlighting for 100+ languages
---Horizontal rule
Column 1 | Column 2 (GFM)Table

Math (KaTeX)

SyntaxResult
$E = mc^2$Inline math
$$…$$ or display blockBlock-level math, centred

Callouts

Cairn supports Obsidian-style callout blocks using a blockquote with a type tag on the first line:

> [!NOTE]
> This is a note callout.

> [!WARNING]
> This is a warning.

> [!TIP]
> Supported types: NOTE, TIP, INFO, WARNING, DANGER, SUCCESS, QUESTION, QUOTE

Footnotes

SyntaxResult
text[^1] + [^1]: definitionSuperscript reference with footnote list at bottom of page

AI text actions

The AI row in the toolbar applies to the current selection. All actions require text to be selected except Custom when the cursor is in a line.

ActionWhat it does
RephraseRewrites the selection with the same meaning but different wording
SummarizeCondenses the selection to its key points
ExpandElaborates on the selection with additional detail
Fix GrammarCorrects grammar and spelling without changing meaning
Change ToneOpens a tone picker: Professional, Casual, Concise, Enthusiastic
Custom…Type your own instruction — the AI applies it to the selection

AI text actions require an AI endpoint to be configured in Settings → AI & Chat. See AI Chat for setup instructions.

File storage

Each note is saved as a plain .md file at:

workspace/notes/<Project Name>/<Note Title>.md

Notes are written with YAML frontmatter containing the note ID, creation date, and tags:

---
id: note_abc123
title: v0.9.1 Release Notes
created: 2026-05-03T09:00:00.000Z
tags:
  - release
  - docs
---

# v0.9.1 Release Notes
…

External edits to the .md file are detected automatically via a file watcher and reflected in the app within a few seconds — no manual refresh needed.