Skip to content
rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

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.

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
publisher-clean-html.prompt.mdmarkdown
# 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` for React/Next or add `--framework sveltekit` for the Svelte preview. Build a ModuleRegistry, call publishPage(tree, registry, options), and preview the resulting full HTML document with PublishPreview. Both framework adapters share the exact same renderer/sanitizer/CSP core. Enable rich HTML/SVG by configuring DOMPurify once; without it those paths stay fail-closed.

## 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.