Skip to content

feat: WYSIWYG document editing with Milkdown Crepe#13

Merged
anbturki merged 1 commit into
mainfrom
feat/wysiwyg-crepe-editor
Jul 4, 2026
Merged

feat: WYSIWYG document editing with Milkdown Crepe#13
anbturki merged 1 commit into
mainfrom
feat/wysiwyg-crepe-editor

Conversation

@anbturki

@anbturki anbturki commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces the whole-file textarea quick editor with an in-place WYSIWYG editing surface built on Milkdown's Crepe editor (ProseMirror + remark over plain markdown - no block document model). The pencil now opens a doc as it reads, with a slash menu, block drag handles, a selection toolbar, and live tables. Agents remain the primary writers; this is the human editing affordance.

Editing safety

  • Frontmatter untouched - split off before editing, re-attached byte-for-byte on save. Metadata is never reformatted.
  • Unchanged docs are never rewritten - the dirty check compares against Crepe's own normalized serialization captured at load, so opening + closing without edits is a no-op.
  • On-disk-change guard - a save is refused if an agent or external tool changed the file during the edit session; the user gets a reload prompt instead of a silent overwrite.

UX

  • Save / Cancel live in the header where the pencil was; editor fills the full reader column width and height (not a boxed textarea), transparent surface.
  • Themed to match the reader exactly: prose typography scale + weights, muted list markers, accent task checkboxes.
  • Lazy-loaded (React.lazy) so ProseMirror/CodeMirror stay off the reader's initial bundle.

Round-trip verification

Headless serialization test (real @milkdown/crepe, getMarkdown() of loaded samples):

Content Result
Fenced code (```mermaid, svgbob) byte-identical
Inline + block math ($…$, $$…$$) byte-identical
Tables, task lists cosmetic normalization only (-*, divider padding); renders identically
HTML comments (AC:BEGIN/END progress delimiters) preserved
GitHub Alert > [!NOTE] marker escapes to > \[!NOTE] on edit

The alert escaping is harmless today (the reader has no alert plugin, so both forms render as a plain blockquote). When alert rendering lands as a Tier-1 reader feature, that work must un-escape alert markers on save.

Validation

  • tsc --noEmit clean
  • 116 tests pass (adds CrepeEditor flow, splitFrontmatter round-trip, saveEdit frontmatter / no-op / on-disk-change coverage; removes QuickEditor + its test)
  • bun run build succeeds

Deferred

Editor screenshots for docs/ can follow; docs/FEATURES.md already describes the WYSIWYG editor in text.

Replace the whole-file textarea quick editor with an in-place WYSIWYG
surface built on Milkdown's Crepe editor (ProseMirror + remark over
plain markdown, no block document model). The pencil now opens the doc
as it reads, with a slash menu, block drag handles, a selection toolbar,
and live tables; agents remain the primary writers.

Editing safety:
- Frontmatter is split off before editing and re-attached byte-for-byte
  on save, so metadata is never reformatted.
- An unchanged doc is never rewritten: the dirty check compares against
  Crepe's own normalized serialization captured at load.
- A save is refused if the file changed on disk during the edit session
  (agent or external write), surfacing a reload prompt instead.

The editor is themed to match the reader exactly (prose typography,
muted list markers, accent checkboxes, transparent surface) and is
lazy-loaded so it stays off the reader's initial bundle. Save/Cancel
live in the header where the pencil was.

Removes QuickEditor and its test; adds CrepeEditor, its theme, a
splitFrontmatter helper with round-trip tests, and saveEdit coverage
for the frontmatter, no-op, and on-disk-change paths.
@anbturki anbturki merged commit 5bd4f24 into main Jul 4, 2026
3 checks passed
@anbturki anbturki deleted the feat/wysiwyg-crepe-editor branch July 4, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant