lietzsche;noether
Pages

updated 2026-11-26·3 min read

Editor Engine & Live Preview

Technical breakdown of Noether's TipTap 2.x / ProseMirror Live Preview editor, incremental syntax decoration mapping, KaTeX render cache, bounded undo history, and hover previews.

Split-pane Markdown editors make your eyes ping-pong between raw hashes on the left and rendered HTML on the right, while pure WYSIWYG editors hide syntax until tables and equations turn painful to edit. Noether uses TipTap 2.x and ProseMirror in a Live Preview setup so formatted blocks render inline and raw Markdown syntax unveils itself only when your cursor enters a token.

Noether Live Preview editor in dark mode showing YAML properties, callout, inline KaTeX, and display math
Live Preview rendering YAML frontmatter, callouts, and KaTeX equations inside the TipTap/ProseMirror canvas

1. Why Live Preview over Pure Source or WYSIWYG?

When your cursor sits outside a formatted block, it renders as typography, live math, interactive checkboxes, and callout boxes. Move your cursor inside the element and the raw tokens (# heading, **bold**, [[wikilink]], $E=mc^2$) show up right under your caret so you don’t have to guess what’s actually in the .md file.

2. Fast Syntax Decorations

Re-scanning a whole multi-thousand-line note on every keystroke drops frames, so syntax decorations update incrementally:

[ User Keystroke at Pos 1,420 ]
  │
  ├── 1. ProseMirror Transaction dispatches
  │
  ├── 2. Map Existing Decorations:
  │      DecorationSet.map(tr.mapping, doc) → O(K) where K = active decorations
  │
  └── 3. Rescan ONLY Dirty Block:
         Check paragraph [1,400 .. 1,460] for wikilinks or tags

ProseMirror shifts existing decoration offsets with tr.mapping and only re-parses the block you actually edited.

3. In-Memory KaTeX Render Cache

Re-running KaTeX across every math block on mount or transaction lags badly on formula-heavy notes, so rendered KaTeX HTML strings sit in an in-memory Map (mathChipKatexCache, capped at 1,500 entries, evicting the oldest 500 keys when full) keyed by display mode (B or I) and equation source. Typing near the top of a long note pulls every unchanged formula further down straight from the cache.

4. Undo History and Memory Limits

Left unbounded, ProseMirror’s undo stack piles up hundreds of step inversions over a long session and bloats heap memory. Noether caps the main editor’s undo stack at 50 steps (depth: 50, newGroupDelay: 500, and depth: 30 in compact preview instances) so older steps prune automatically.

Hovering over an internal link opens a read-only preview popover without switching tabs (WikilinkHoverPreview in EditorCanvas):

  • Hovering a .md-wikilink element triggers a 250ms activation debounce before resolving the target document and opening the popover (skipping empty notes and external URLs).
  • The popover anchors with an 8px collision margin using CSS top when placed below the link or bottom when placed above, plus an invisible 10px hover bridge spanning the gap so your pointer doesn’t drop the preview mid-move.
  • Preview contents render through DocumentView with compact={true}, keeping callouts, KaTeX math, tables, code highlighting, and task checkboxes consistent with the main editor.
  • Leaving the link or preview starts a 200ms close grace period, and scrolling inside the popover stays isolated from the main document.

Search wiki and portfolio

type to search across all entries.