Skip to content

T-ZPKQ-pumice-admin-body-renderer-seam

State: closed/done · Impact: medium · Complexity: medium

Pumice’s admin detail page renders an entity body with marked and DOMPurify, and the host carries a Vite alias block to make the admin layer’s optional peers resolve. This task makes the admin layer renderer-agnostic through an injection seam, has pumice supply MdViewer, and deletes the second markdown stack and the alias block.

LocationRole today
apps/pumice/packages/nuxt_admin_layer/app/pages/admin/[entity]/[id]/index.vueThe only render site: DOMPurify.sanitize(await marked.parse(body)) into parsedBody
apps/pumice/packages/nuxt_admin_layer/package.jsonmarked and dompurify as optional peerDependencies
apps/pumice/packages/nuxt_admin_layer/app/composables/useAdminEntity.ts, useAdminRegistry.ts
apps/pumice/src-nuxt/package.jsonmarked, dompurify; @determined/ui by file:
apps/pumice/src-nuxt/nuxt.config.tsExtends the admin layer and @determined/ui; vite.resolve.alias for marked and dompurify
apps/pumice/bun.lockIsolated lockfile, checked by .github/workflows/lockfile-drift.yml

The admin layer exports AdminBodyRendererKey (an InjectionKey for a Vue component taking source: string) from a new useAdminBodyRenderer.ts. The detail page renders <component :is="bodyRenderer" :source="body" /> when a renderer is provided and an escaped <pre> otherwise. Pumice provides MdViewer from a client plugin. marked and dompurify leave both package.json files, the alias block is deleted, @sksizer/markdown-ui is wired by file: with overrides for its workspace:* transitives, and bun.lock is regenerated.

  1. Admin layer: add app/composables/useAdminBodyRenderer.ts exporting the injection key and a useAdminBodyRenderer() that returns the injected component or null; rewrite the body section of [id]/index.vue; remove marked/dompurify from peerDependencies and peerDependenciesMeta.
  2. Pumice src-nuxt/package.json: add @sksizer/markdown-ui, @sksizer/obsidian-md, @sksizer/obsidian-editor, @sksizer/markdown-util by file: with matching overrides; delete marked, dompurify.
  3. src-nuxt/nuxt.config.ts: add the layer to extends after the admin layer; delete the vite.resolve.alias block; add vite.resolve.dedupe for vue, @codemirror/state, @codemirror/view, @lezer/common; add optimizeDeps.include: ['unified', 'extend', 'debug'] as SDF does.
  4. Add src-nuxt/app/plugins/admin-body-renderer.ts providing MdViewer under the key.
  5. cd apps/pumice && bun install; commit bun.lock; bun install --frozen-lockfile.
  6. Verify: bun run typecheck, bun run test:stories, bun run test:e2e in src-nuxt; nuxi analyze shows no marked chunk; an admin detail page with a fence and a table in light and dark; moon run :check :test --affected. Flip the pumice row of the duplicates ledger in docs/LIBRARIES.md.
LocationKindChange
apps/pumice/packages/nuxt_admin_layer/app/composables/useAdminBodyRenderer.tsnewInjection key and accessor
apps/pumice/packages/nuxt_admin_layer/app/pages/admin/[entity]/[id]/index.vuemodifyRender through the injected component; delete marked/DOMPurify
apps/pumice/packages/nuxt_admin_layer/package.jsonmodifyDrop the optional peers
apps/pumice/src-nuxt/package.jsonmodifyLayer and transitives by file: with overrides; delete marked, dompurify
apps/pumice/src-nuxt/nuxt.config.tsmodifyExtend the layer; delete alias block; dedupe and optimizeDeps
apps/pumice/src-nuxt/app/plugins/admin-body-renderer.tsnewProvides MdViewer
apps/pumice/bun.lockmodifyRegenerated
docs/LIBRARIES.mdmodifyPumice render-site row flips to resolved
  • AC-1: grep -rn "marked\|dompurify" apps/pumice --include=package.json --include=nuxt.config.ts --include=*.vue returns nothing, and apps/pumice/bun.lock has no marked or dompurify entry.
  • AC-2: [id]/index.vue contains no v-html fed by marked; with no renderer injected the body renders as an escaped <pre> (story or unit test).
  • AC-3: bun run typecheck, test:stories and test:e2e pass in apps/pumice/src-nuxt.
  • AC-4: bun install --frozen-lockfile passes in apps/pumice; the lockfile-drift workflow is green.
  • AC-5: nuxi analyze lists no marked chunk; light and dark screenshots of an admin body are attached to the PR.
  • TemplateEditor.vue; it does not render markdown.
  • Editing entity bodies in pumice.
  • Moving the admin layer out of apps/pumice/packages/.

Member of milestone M-931L; wave 4a of D-K3EM-markdown-editor-chrome-and-plugin-environment.

T-A0HT-md-ui-layer-skeleton


← Back to Tasks