Slice · AI prompt
Render a node tree to standalone, framework-runtime-free HTML with one deduped CSS bundle + layered sanitization (HTML/CSS/CSP + injectable DOMPurify). Zero deps, no Convex.
# Install `publisher-clean-html` — Publisher — clean HTML
> Render a node tree to standalone, framework-runtime-free HTML with one deduped CSS bundle + layered sanitization (HTML/CSS/CSP + injectable DOMPurify). Zero deps, no Convex.
📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail : https://resource.rahmanef.com/slices/publisher-clean-html
🧠 JSON catalog : https://resource.rahmanef.com/api/knowledge?slice=publisher-clean-html
🔗 Source : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/publisher-clean-html
## 1. Install
```bash
npx rahman-resources add publisher-clean-html
# alias: npx rr add publisher-clean-html
```
The CLI copies `frontend/slices/publisher-clean-html/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.
## 3. Wire it up
Run `npx rr add publisher-clean-html`. Build a registry: createModuleRegistry([{ id: 'base.body', render: (_p, kids) => ({ html: kids.join('') }) }, { id: 'demo.h', schema: { text: { type: 'text' } }, render: (p) => ({ html: `<h1>${p.text}</h1>`, css: 'h1{font-size:1.5rem}' }) }]). Tree = { rootNodeId, nodes: { [id]: { id, moduleId, props?, children?, classIds?, inlineStyles?, hidden? } } }. const { html } = publishPage(tree, registry, { title, cssEmission: 'inline' }). Preview: <PublishPreview html={html} />. Enable rich HTML/SVG by calling configureRichtextSanitizer(DOMPurify) once — without it, richtext/svg props fail closed (strip/empty). Props escape by schema control type, not key name.
## Rules of engagement
- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice
The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.