Editor document schema in packages/shared #24

Closed
opened 2026-07-04 14:52:08 +02:00 by fable-5 · 1 comment
Collaborator

Context

Editor, server derivation, exports, and plugin validation must agree on one document schema (ADR 0004).

Scope

Define the ProseMirror schema in packages/shared/src/editor-schema/: doc, paragraph, headings 1–4, bullet/ordered/task lists, blockquote, code block, table, image (attrs: fileId, alt, width), horizontal rule, hard break; marks: bold, italic, code, strikethrough, link (href, protocol-allowlisted). Reserve node names wikilink and plugin_block (added later). Provide docToMarkdown, markdownToDoc, docToPlainText, docToHtml, extractOutline built on prosemirror-markdown/model, with fixture-based unit tests.

Acceptance criteria

  • round-trip fixture suite: markdown → doc → markdown is stable for the supported node set
  • docToHtml escapes everything and allowlists link protocols (security.md)
  • outline extraction returns heading tree with stable ids
  • package has zero DOM dependencies (runs in Node for the API)

Technical notes

  • ADR 0004, security.md §Content.
  • Table support: basic (no col/rowspan UI requirements yet) but schema-complete.

Dependencies

Depends on #1.

Size: ~1.5 days


Conventions: English code/comments, clear human-readable code, no hard-coded UI strings (ADR 0012, add de and en), permission checks only via the shared guard (docs/architecture/permissions.md). Read the referenced ADRs before starting.

## Context Editor, server derivation, exports, and plugin validation must agree on one document schema (ADR 0004). ## Scope Define the ProseMirror schema in `packages/shared/src/editor-schema/`: doc, paragraph, headings 1–4, bullet/ordered/task lists, blockquote, code block, table, image (attrs: fileId, alt, width), horizontal rule, hard break; marks: bold, italic, code, strikethrough, link (href, protocol-allowlisted). Reserve node names `wikilink` and `plugin_block` (added later). Provide `docToMarkdown`, `markdownToDoc`, `docToPlainText`, `docToHtml`, `extractOutline` built on prosemirror-markdown/model, with fixture-based unit tests. ## Acceptance criteria - [ ] round-trip fixture suite: markdown → doc → markdown is stable for the supported node set - [ ] `docToHtml` escapes everything and allowlists link protocols (security.md) - [ ] outline extraction returns heading tree with stable ids - [ ] package has zero DOM dependencies (runs in Node for the API) ## Technical notes - ADR 0004, security.md §Content. - Table support: basic (no col/rowspan UI requirements yet) but schema-complete. ## Dependencies Depends on #1. **Size**: ~1.5 days --- *Conventions: English code/comments, clear human-readable code, no hard-coded UI strings (ADR 0012, add `de` **and** `en`), permission checks only via the shared guard (docs/architecture/permissions.md). Read the referenced ADRs before starting.*
fable-5 added this to the M2 — Ponds & pages, single-user editing milestone 2026-07-04 14:52:08 +02:00
fable-5 added the
frontend
label 2026-07-04 14:52:08 +02:00
Collaborator

Note: the initial commit (b89aa6b) auto-closed this issue via the Closes #24 keyword on push, but CI's Lint, typecheck, test job actually failed (Prettier formatting was not checked locally before pushing, only ESLint). Fixed in b0d9a00 — full pipeline is now green: https://gitea.101010.cloud/stwaidele/dorfteich/commit/b0d9a00

Lesson for future sessions: run pnpm lint (ESLint and Prettier) locally before pushing, not just ESLint on the changed files.

Note: the initial commit (b89aa6b) auto-closed this issue via the `Closes #24` keyword on push, but CI's `Lint, typecheck, test` job actually failed (Prettier formatting was not checked locally before pushing, only ESLint). Fixed in b0d9a00 — full pipeline is now green: https://gitea.101010.cloud/stwaidele/dorfteich/commit/b0d9a00 Lesson for future sessions: run `pnpm lint` (ESLint **and** Prettier) locally before pushing, not just ESLint on the changed files.
Sign in to join this conversation.
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stwaidele/dorfteich#24
No description provided.