Render authoring (@glw907/cairn-cms/render)
The component-authoring toolkit a site reaches for inside a component’s build(ctx). These helpers
build hast and read the component context. The render pipeline itself stays behind createRenderer
on the package root. That function is the one public, safe-by-default render path.
import { cardShell, headRow, iconSpan, strAttr } from '@glw907/cairn-cms/render';
Hast builders
Stability tier: Extension API.
cardShell(classes, body)wraps body content in a<section><div class="card-body">shell.headRow(title, icon?, level?)builds the icon-plus-heading head row; the heading level defaults to 2.iconSpan(glyphEl, role?)wraps a built glyph element in anec-iconspan.
Context and tree helpers
Stability tier: Extension API.
strAttr(ctx, key)reads a declared string attribute off the component context, returningundefinedfor a boolean or absent value.isElement(node)narrows a hast node to anElement.
Types
Stability tier: Extension API.
ComponentContextis the structured input abuildreceives (attributes, slots, the stamped node).MakeIconis a site’s icon factory signature,(name, role?) => Element.