Commit 3b06447
committed
q2-preview: body container + title block (Plan 2D)
Phase 6.0 framework extraction:
- Lift `inlinesToPlainText` / `blocksToPlainText` to `framework/plainText.ts`.
- Add `framework/meta.ts` with `extractMetaString` / `extractMetaBool` /
`extractMetaStringList`.
- Flat barrel re-exports on `framework/index.ts` (plainText, meta,
customNode bookkeeping fix).
- Tighten `FormatRegistry` at `framework/types.ts` with typed optional
entries for the two synthetic keys (`__fallback__`, `__title_block__`).
- Migrate `ReactAstSlideRenderer.tsx`'s private `extractMetaString` to the
framework helper. Deliberate behavior change for slide titles/authors
containing inline markup (Emph/Strong/Code/Link now render as text
instead of empty string) locked by a regression test.
- Consolidate `meta.format` extraction in `ReactRenderer.tsx` and
`getQ2Format.ts` onto the framework helper.
- Expose framework helpers on `window.__Q2_PREVIEW_RENDERER__` for
user TSX overrides.
Phase 6.1+ body container in `PreviewDocument.tsx`:
- Page-layout-aware `<div id="quarto-content"><main class="content">`
wrapper mirrors Rust template at `template.rs:185-247`.
- Imperative `document.body.className` management via useEffect with
cleanup-on-unmount.
- Minimal-mode title synthesis re-implements
`transforms/title_block.rs:54-110`'s minimal-mode branch React-side
(the transform is in `Q2_PREVIEW_TRANSFORM_EXCLUDED`).
- Iframe `document.title` wiring from `meta.pagetitle ?? meta.title`,
only when non-empty (preserves the static `q2-preview.html` title for
untitled docs).
Phase 7 title block:
- New `q2-preview/custom/PreviewTitleBlock.tsx` (~110 LOC) mirrors Rust
template at `template.rs:211-240` byte-for-byte. Multi-author and
date-without-author Rust quirks deliberately replicated to avoid
per-format CSS forks.
- Registered under synthetic `__title_block__` key in `previewRegistry`;
mounts inside `<main>` ahead of body blocks. `AstProps` shape parallels
the `Ast` key (not `NodeArgs`).
- Built-in exposed on `__Q2_PREVIEW_RENDERER__` so user TSX overrides
can compose (rather than fully replace) the chrome.
Tests:
- 27 unit tests for framework/meta.ts + framework/plainText.ts
- 18 integration tests for PreviewDocument (body container, body classes,
minimal-mode title synthesis, iframe document.title)
- 17 integration tests for PreviewTitleBlock (required elements,
Pandoc-falsy semantics, user override full-replacement + composition)
- Synthetic-key registration directly asserted in registry.test.ts (closes
a pre-existing gap on `__fallback__`).
Smoke-all q2-preview fixtures (11 new):
- body-container-default / -full-layout / -minimal / -minimal-title
- body-classes-override / -full-layout-combo
- title-block-default / -full / -no-title / -multi-author / -date-no-author
All 11 fixtures green in Playwright e2e; full plan checklist (19 items)
ticked; cargo xtask verify clean.1 parent 8caec72 commit 3b06447
33 files changed
Lines changed: 2110 additions & 311 deletions
File tree
- claude-notes/plans
- crates/quarto/tests/smoke-all/q2-preview
- hub-client/src/components/render
- framework
- q2-preview
- custom
- inlines
Lines changed: 436 additions & 100 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments