@open-press/core/manuscript
Manuscript helpers
Optional helpers for long-form section flow. Sections walks a registered source and emits one frame per section, paginating across as many frames as the content needs. Toc + TocArea give you a generated table of contents.
Slide and social packs typically skip this module — they declare their pages manually with
<Frame>. The manuscript layer is for reports, papers, monographs, and books.
Iterates a registered MDX source and emits frames for each section, spawning extra frames when content overflows. Each emitted frame renders your page component once per page.
import { Sections } from "@open-press/core/manuscript"; <Sections
source="story"
page?={SectionsPageComponent}
opener?={SectionsOpenerComponent}
/> Props
| Name | Type | Default | Description |
|---|---|---|---|
source required | string | The sourceId registered in press/index.tsx sources. | |
page | ComponentType<SectionsPageProps> | DefaultSectionPage | Per-page component the helper renders for each frame it spawns. Receives frameKey, chainId, pageIndex, totalPages, sectionSlug, sectionTitle, sectionTone. |
opener | ComponentType<SectionsOpenerProps> | Optional component rendered before each section's first content page (chapter opener / divider). Receives frameKey, sectionSlug, sectionTitle, sectionTone. |
<Press>
<Sections source="story" />
</Press> function ContentPage({
frameKey, chainId, pageIndex, totalPages, sectionTitle,
}: SectionsPageProps) {
return (
<Frame frameKey={frameKey} role="document.content">
<div className="page-frame">
<main className="page-body">
<MdxArea chainId={chainId} />
</main>
<footer className="page-footer">
<span>{sectionTitle}</span>
<span>{pageIndex + 1}/{totalPages}</span>
</footer>
</div>
</Frame>
);
}
<Press><Sections source="story" page={ContentPage} /></Press> Identical to Sections — alias for vocabulary clarity when your source uses 'chapter' instead of 'section'. ChaptersProps === SectionsProps.
import { Chapters } from "@open-press/core/manuscript"; The fallback page component <Sections> uses when no page prop is supplied. Renders a standard manuscript frame with header / body / footer chrome and a single MdxArea filling the body.
import { DefaultSectionPage } from "@open-press/core/manuscript"; <DefaultSectionPage {...sectionsPageProps} /> Emits a frame for the table of contents. The engine generates a TOC chain by walking the source's heading structure; Toc allocates that chain into one or more frames.
import { Toc } from "@open-press/core/manuscript"; <Toc
source="story"
maxLevel?={3}
page?={TocPageComponent}
/> Props
| Name | Type | Default | Description |
|---|---|---|---|
source required | string | Source id to build a TOC from. | |
maxLevel | number | 3 | Deepest heading level included in the TOC. 1 = H1 only, 3 = H1+H2+H3. |
page | ComponentType<TocPageProps> | Optional custom TOC page component. Default page renders <TocArea> inside a standard frame. |
A measurable TOC content slot — the TOC equivalent of MdxArea. Use inside a custom <Toc> page component when you need to control the surrounding layout. The default Toc page already wraps a TocArea for you.
import { TocArea } from "@open-press/core/manuscript"; <TocArea
chainId="toc:story"
maxLevel?={3}
overflow?="extend"
className?
/> Props
| Name | Type | Default | Description |
|---|---|---|---|
chainId required | string | TOC chain id — typically toc:<sourceId>. | |
maxLevel | number | 3 | Deepest heading level rendered as a TOC entry. |
overflow | "extend" | "truncate" | "extend" | Same semantics as MdxArea. |
className | string | Appended to the rendered <ol class="toc-list"> wrapper. |
Notes
-
Manuscript frames carry
role="manuscript.content"orrole="manuscript.toc"by default — themes use those role strings to scope CSS. -
The TOC source chain is named
toc:<sourceId>and is generated by the engine, not registered manually. You can't write into a TOC chain; only the heading walker fills it. -
Slide / social starters intentionally skip this module. If you find yourself fighting the manuscript
page component for a fixed-format page, write
<Frame>directly withchrome=+MdxArea overflow="truncate".