Repository navigation
feat(ui): ComarkHtml shows rendered HTML in Vue and runs its scripts - #431
Conversation
…s scripts v-html leaves inline scripts inert, so a Vue app that renders documents with comark-ui/html had to pull the scripts out and add them to the page itself. ComarkHtml reruns them on mount and when the HTML changes; every package's script starts once per page. The docs site's own copy is replaced by it.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
comark-annotate
comark-badge
comark-bundle
comark-cards
comark-carousel
comark-cast
comark-charts
comark-chat
comark-chips
comark-cjk
comark-code
comark-code-notes
comark-colors
comark-comments
comark-critic
comark-deflist
comark-details
comark-diagrams
comark-diff
comark-embed
comark-fields
comark-figure
comark-file-tree
comark-footnotes
comark-git-graph
comark-github
comark-icon
comark-include
comark-keys
comark-links
comark-linter
comark-magic-move
comark-mark
markdown-it-to-comark
marked-to-comark
comark-mathml
comark-media
comark-metrics
migrate-to-comark
comark-outline
comark-properties
comark-qr
comark-quiz
comark-reading-time
remark-to-comark
comark-sources
comark-steps
comark-table
comark-tabs
comark-tests
comark-time
comark-ui
comark-xref
comark-zoom
commit: |
There was a problem hiding this comment.
Important
The new component drops valid CSP nonces when recreating scripts, leaving interactive blocks inactive under the documented nonce-based policy.
Reviewed changes — Reviewed the new public Vue component, its docs integration, and its browser tests.
- HTML host component: Exports
ComarkHtmlwith configurable root markup and script execution on mount and HTML updates. - Docs migration: Replaces the local component with the public export and moves wrapper attributes into the parser output.
- Documentation and verification: Documents HTML-in-Vue usage and adds browser coverage; the workspace build, 28 focused renderer tests, and all three new browser tests pass, but a separate HTTP-header CSP reproduction fails.
gpt-6.1-sol(xhigh) | 𝕏
Imported from comark-ui/vue, it bundled every block's Vue components: about 1 MB more client JavaScript on onmax.me. comark-ui/vue still re-exports it.
There was a problem hiding this comment.
ℹ️ No new defects found in this update; the existing P1 review thread remains unresolved.
Reviewed changes — Reviewed the changes from 3d6374c to 00cc4a7, focused on the standalone HTML/Vue entry and its packaging boundary.
- Extracted the lightweight entry: Moved
ComarkHtmlintocomark-ui/html/vue, added its package export and build entry, and retained thecomark-ui/vuere-export without changing runtime behavior. - Updated consumers: Switched the browser fixture and guide example to the dedicated entry and documented the heavier alternative import.
Validation passed: workspace build and publint, 28 focused tests, all three browser tests, published-subpath type resolution, SSR attributes, and re-export identity. A browser bundle of the published entry included Vue and the HTML host only, with no block renderers or parser preset.
gpt-6.1-sol(xhigh) | 𝕏
Latest result Pull request merged. Final answersSession Pull request merged. |
There was a problem hiding this comment.
✅ No new issues found; no P0 or P1 findings remain.
Reviewed changes — Reviewed 00cc4a7 → 9042fda, focused on CSP nonce preservation and its regression coverage.
- Preserved effective script nonces: Copied the source script's
.nonceproperty before inserting its replacement, addressing the previously reported failure under HTTP-header CSP. - Added CSP regression coverage: Verified script execution on mount and HTML updates, nonce hiding, and working zoom under a nonce-based HTTP policy.
- Adapted the browser loader: Served the test bundle from a routed same-origin URL so the application loader respects the test's CSP.
Validation passed: workspace build and publint, 28 focused tests, all four ComarkHtml browser tests, and targeted lint.
gpt-6.1-sol(xhigh) | 𝕏

A Vue app that renders its documents with
comark-ui/html, such as onmax.me at build time, shows them withv-html, andv-htmlnever runs the inline scripts. Zoom, carousels, embeds and annotate's buttons stay dead unless the app pulls each<script>out and adds it to the page head itself. onmax.me does that insplitScripts()and auseHeadcall.This adds
ComarkHtmlin a new entry,comark-ui/html/vue, promoted from the docs site's ownComarkHtml.vue.comark-ui/vuere-exports it, but an app that renders on the server should import the small entry: fromcomark-ui/vue, onmax.me's client JavaScript went from about 1.08 MB to 2.06 MB, since that entry pulls in every block's Vue components. It renders the HTML and reruns its scripts after it mounts and wheneverhtmlchanges. Every package's script starts once per page, so the copies a server render already ran do nothing. It takestag(divby default,spaninside a paragraph). The docs site now uses it, withclassanddata-blockset on the node instead of the oldblockprop.e2e/comark-html.e2e.tsmounts it in Chromium: a script in the HTML runs once and again after an update, and a zoomable image rendered bycomark-zoom/htmlopens its zoom dialog. With the reruns removed, the counter and the zoom tests fail.The renderers guide gets a section on it. React and Svelte get none for now.
I built onmax.me against this PR's pkg.pr.new build with
splitScripts(), thescriptsfield and theuseHeadscripts deleted, and the post rendered throughComarkHtml. The X embed gets the same 648px height from comark-embed's script, zoom opens, the same four runtimes start, and the screenshots are pixel-identical to 0.12.1's. Client JS goes from 1,076,374 to 1,076,701 bytes. Before/after: https://drop.vitehub.dev/d/jkykj7vjcx57/onmax-me-comark-ui-n8