Skip to content
SprecherEast
Issue 790

documentation: Knowledge note for rich text and the editorial blocks (src/platform/richtext)

Back to our plan
Done
documentationfrontendcmstoolingpriority: medium

Type

documentation

Summary

Write the short note on rich text: how an article's text is drawn, the editorial blocks editors can put inside it (key facts, fact tabs, steps, timeline, outcome fork, diagram key, charts), the limits they share, and how agents write the same blocks as Markdown tags.

Problem

Each editorial block has a stored shape, a mapper to plain props, a renderer, limits and, for two of them, a Markdown tag agents write. These pieces are in about 50 files, and a limit or a block type changed in one place must match the others.

What the generated reference already shows, so the note doesn't repeat it: The rich-text components page, opens in a new tab lists each renderer's props and where it is used; the content-type pages list the rich-text fields of posts, events and pages. Check whether they list the blocks allowed inside rich text and their fields; the note links what they show and adds the rest.

Proposed fix

Write src/platform/richtext/README.md from the template. Owner's direction for every note (2026-11-06, Claude session, recorded on #712 and #719): a note explains the behavior and logic of its content types and code (what shows, where, when, who publishes or changes it, and the special rules), never a list of fields; and every link between fields is stated near the top, so no agent has to work it out from the code.

Links between fields the note states up front (each one checked in the code first):

  • Each block's limits are defined once in editorial/editorialLimits.ts and read by its Payload fields, its Markdown tag's schema and the tests (guard rail 1).
  • Block slugs are written once in editorial/blockTypes.ts; the configs, the Markdown tags and the article-width rule match on them.
  • Stored block → plain props: each editorial/<block>.ts maps the stored fields (rows of numbers, a hatching checkbox) to what the renderer draws, dropping items without a heading or value (decision 0013; editorial/chart.ts maps both ways to ChartSpec).
  • <Chart … /> and <FactTabs … /> tags are written and read with one escaping (editorial/editorialTag.ts, chartMarkdown.ts, factTabsMarkdown.ts), used by the agents' suggestions.
  • Heading text → anchor ids for the "On this page" menu (headingAnchors.ts, articleToc.tsx); a document's first heading → a hero title (splitHeadingFromBody.ts, used by site).
  • A chart part's key comes from its label, so the same part links across two groups' legends (editorial/chartKeys.ts).

Behaviors and rules the note must cover (each with the file or test named):

  • Text keeps the reading width, but an article holding key facts, fact tabs or an outcome fork fills the column (articleColumn.ts, #774).
  • The "On this page" menu appears from three sections (articleToc.tsx, #574).
  • A field of only spaces counts as empty (editorial/filledText.ts); list blocks count rows the way Admin sends them (editorial/rowCount.ts, #676).
  • A chart block is validated as a whole and each reason shows under its field (editorial/chartValidate.ts).
  • A timeline has at most one "Next up" milestone, and status is never shown by colour alone (editorial/timelineBlockConfig.ts, timelineStatus.ts).
  • Which blocks each collection's rich text offers, and that renderers are passed in by the caller (blockConfigs.ts, richTextBlocks.tsx, RichText.tsx).
  • Plain text for structured data (toPlainText.ts); the media block's two placements (MediaBlock.tsx, #541).

Tests to name under "Rules and the tests that protect them": editorial/*.test.ts(x), articleColumn.test.ts, articleToc.test.tsx, headingAnchors.test.ts, splitHeadingFromBody.test.ts, RichText.test.tsx, and src/payload.config.chartBlock.test.ts, factTabs*.test.ts, rowCounts.test.ts.

Map entry: { "note": "src/platform/richtext/README.md", "paths": ["src/platform/richtext/**"] }

Acceptance criteria

  • Not done: src/platform/richtext/README.md follows docs/knowledge/note-template.md and is at most 80 lines.
  • Not done: It explains behavior and logic, not fields: no field lists, props tables or route lists. It links the generated pages named above for those.
  • Not done: Right after its opening sentences, a short list states every link between fields named above (relationships, values copied or derived, mapper inputs and the props they become, hooks that copy a value), each with its file.
  • Not done: Every behavior listed above is covered or, if the code turns out different, the note says what the code does and this issue gets a comment saying what changed.
  • Not done: Every statement names the file or test it comes from, checked against the code at the branch's base.
  • Not done: docs/knowledge/index.md gets one short line for the note (a few words after the link). It stays within the budget check.
  • Not done: docs/knowledge/map.json gets the entry above.
  • Not done: npm run agent-context -- --write has been run and its generated rule committed, and npm run agent-context passes. If the budget check fails, this issue is not done; trimming other always-loaded files is not part of this issue.
  • Not done: Known contradictions: none of #279, #158, #366 or #531 applies. #676 (blocks accept a number in place of their list) is open: name it under Known gaps.
  • Not done: No code changes. A bug or gap found in the code goes under the note's "Known gaps" and is filed as its own issue (labeled scope-creep, linked here).
  • Not done: Prettier, Knowledge sync, PR Policy and Agent context pass.

Files likely touched

  • src/platform/richtext/README.md
  • docs/knowledge/index.md (one line)
  • docs/knowledge/map.json (one entry)
  • .claude/rules/generated/src--platform--richtext--README.md

Must not touch

  • Code under src/ (the note itself excepted): this issue documents behavior and changes none.
  • Other notes, their generated rules, and the files the other note issues under #712 list.
  • docs/knowledge/note-template.md and the session-start set (CLAUDE.md, AGENTS.md, docs/guidelines/guard-rails.md).
  • docs/architecture/data-model.md, docs/ui/data-types.md, docs/ui/component-set-modules.md: read them and fold this area's facts into the note (decision 0019, section 7); report any drift in them in a comment on #712 instead of editing them, since every note issue reads them.
  • src/modules/README.md, src/platform/README.md, docs/project.md (#725 owns them).

Open questions

  • Session-start room. The index line needs room at session start, which #799 makes. This issue is blocked by #799 and is not Ready until it lands; the line then stays within the budget check.
  • Dead code first. #728 (the audit, waiting for the owner's keep-or-drop marks) removes unused or unwanted code before a note describes it. This issue is marked blocked by #728; it can start once #728 has settled this area, even if other areas are still open there.
  • Size: not set; a cloud session can't read the board. Suggested: M.

Area

tooling, cms, frontend

Priority

medium


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab