Editor
A whole-document Markdown editor that swaps in for the reader when you want to fix a sentence in place.
Opening
Edit → Edit Document… or ⌘E. The reader pane is replaced by the editor; the rest of the window (tab strip, sidebar, theme) stays where it is.
The editor is enabled only for local Markdown files. URL-fetched tabs, clipboard tabs, and PDF tabs have no writable destination, so the menu item is disabled there.
Source and preview
The editor opens in Source mode by default — raw Markdown in a monospace font. The action row has three buttons:
- Cancel. Discards the draft and returns to the reader. Esc also triggers it.
- Preview / Edit. Toggles between source and a rendered preview.
- Save. Writes the draft to disk and returns to the reader. ⌘Return saves from either mode.
Preview fidelity
Preview uses Foundation's AttributedString(markdown:) for an inline render. It covers paragraphs, headings, lists, bold/italic, inline code, and links — enough to verify formatting is right. It is lower fidelity than the reader pane:
- No syntax-highlighted code blocks.
- No KaTeX math.
- No Mermaid diagrams.
- No images.
- Theme typography is not exact.
For a full-fidelity preview, save and look at the reader pane.
Saving
Save writes the draft atomically to the file's UTF-8 path. The file watcher would normally treat this as an external change; the editor short-circuits that loop so save does not trigger a diff overlay against itself.
Drift detection
If the file changes externally — an agent writes, another app saves, git pull — while you are editing, the editor detects the divergence at save time. You get a three-way prompt:
- Save My Version. Proceed with the draft, overwriting the external change.
- Discard My Edits. Close the editor; the reader picks up the new content the watcher already pulled in.
- Keep Editing. Stay in the editor so the two versions can be merged by hand. Copy the new content from elsewhere, edit the draft to reflect, save.
The check uses a content hash captured at open time, so detection is exact regardless of how the file changed.
Scope
The editor is intentionally small. It is not a replacement for a Markdown writing app — there is no toolbar, no live render, no syntax highlighting, no autocomplete. The goal is the smallest surface that lets you fix a thing in place without switching apps.