@docspack/sheaf-astro
v0.1.0
Published
Renders a Sheaf content graph with Astro's own Markdown pipeline, so a docs site and its agent index come from one parse.
Maintainers
Readme
@docspack/sheaf-astro
Renders a Sheaf content graph with Astro's own Markdown pipeline.
import { graphFromSources } from "@docspack/sheaf";
import { createPageRenderer } from "@docspack/sheaf-astro";
const renderPage = createPageRenderer({ syntaxHighlight: false });
const { html, headings } = await renderPage(page);Why a binding rather than a renderer
createPageRenderer wraps @astrojs/markdown-remark — the same processor Astro uses for a
.md file in src/pages. Your Markdown configuration keeps applying, and a document reaches
a reader through one pipeline whichever route served it.
The part that matters
A table of contents is built from the graph's heading slugs; the anchors it links to are the
ids this renderer stamps. When those disagree the failure is silent — the browser scrolls to
the top instead of erroring. This package asserts they agree for every page it renders.
Options
| | |
| --- | --- |
| syntaxHighlight | false, "shiki" or "prism". Turn it off if your site paints its own code blocks. |
| gfm | GitHub-flavoured Markdown. On by default. |
MIT © docspack
