Resolve file=path[{ranges}] directives in fenced code-block info
strings, replacing the block’s body with the file contents (optionally
sliced by 1-based line ranges).
Replace <ComponentPreview name="X" /> with a CodeBlock carrying the
source of registry component X. registry_index is the JSON manifest;
registry_root is the directory referenced paths resolve against.
Replace <ComponentSource path="..." /> with a CodeBlock carrying the
file contents (resolved against base_dir). lang comes from the file
extension. Path resolution mirrors [CodeImport].
Copy referenced asset files (image srcs and relative hrefs) into
assets_dir, hash-name them via name_template, and rewrite the AST
node to point at the published URL under base_url. map caches
raw -> url so repeated references hash the file only once.
Serialise GFM-only constructs back to plain markdown. ~~strike~~
becomes literal text, tables flatten to pipe-delimited text, task list
items lose their checkbox state and become plain list items.
Render mermaid code blocks to inline SVG via the external mmdc CLI
(@mermaid-js/mermaid-cli). On success the CodeBlock is replaced with
<MermaidSvg svg="..." />. No-ops with Code::MmdcUnavailable when
the CLI is missing; per-block failures emit Code::MermaidRenderFailed.
Detect npm install ..., npx create-..., and npx ... first-lines in
fenced code blocks and replace them with a <PackageManagerTabs> JSX
element carrying the equivalent yarn/pnpm/bun invocations.