Skip to content

feat(ui): ComarkHtml shows rendered HTML in Vue and runs its scripts - #431

Merged
vite-hub[bot] merged 4 commits into
mainfrom
n8/html
Nov 14, 2026
Merged

vite-hub[bot] merged 4 commits into
mainfrom
n8/html

Conversation

@onmax

@onmax onmax commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

A Vue app that renders its documents with comark-ui/html, such as onmax.me at build time, shows them with v-html, and v-html never 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 in splitScripts() and a useHead call.

This adds ComarkHtml in a new entry, comark-ui/html/vue, promoted from the docs site's own ComarkHtml.vue. comark-ui/vue re-exports it, but an app that renders on the server should import the small entry: from comark-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 whenever html changes. Every package's script starts once per page, so the copies a server render already ran do nothing. It takes tag (div by default, span inside a paragraph). The docs site now uses it, with class and data-block set on the node instead of the old block prop.

e2e/comark-html.e2e.ts mounts it in Chromium: a script in the HTML runs once and again after an update, and a zoomable image rendered by comark-zoom/html opens 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(), the scripts field and the useHead scripts deleted, and the post rendered through ComarkHtml. 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

…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.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T17:46:17.313859Z
We couldn’t complete this review. Comment @codex review to try again.
3d6374c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pkg-pr-new

pkg-pr-new Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@431

comark-badge

pnpm add https://pkg.pr.new/comark-badge@431

comark-bundle

pnpm add https://pkg.pr.new/comark-bundle@431

comark-cards

pnpm add https://pkg.pr.new/comark-cards@431

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@431

comark-cast

pnpm add https://pkg.pr.new/comark-cast@431

comark-charts

pnpm add https://pkg.pr.new/comark-charts@431

comark-chat

pnpm add https://pkg.pr.new/comark-chat@431

comark-chips

pnpm add https://pkg.pr.new/comark-chips@431

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@431

comark-code

pnpm add https://pkg.pr.new/comark-code@431

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@431

comark-colors

pnpm add https://pkg.pr.new/comark-colors@431

comark-comments

pnpm add https://pkg.pr.new/comark-comments@431

comark-critic

pnpm add https://pkg.pr.new/comark-critic@431

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@431

comark-details

pnpm add https://pkg.pr.new/comark-details@431

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@431

comark-diff

pnpm add https://pkg.pr.new/comark-diff@431

comark-embed

pnpm add https://pkg.pr.new/comark-embed@431

comark-fields

pnpm add https://pkg.pr.new/comark-fields@431

comark-figure

pnpm add https://pkg.pr.new/comark-figure@431

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@431

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@431

comark-git-graph

pnpm add https://pkg.pr.new/comark-git-graph@431

comark-github

pnpm add https://pkg.pr.new/comark-github@431

comark-icon

pnpm add https://pkg.pr.new/comark-icon@431

comark-include

pnpm add https://pkg.pr.new/comark-include@431

comark-keys

pnpm add https://pkg.pr.new/comark-keys@431

comark-links

pnpm add https://pkg.pr.new/comark-links@431

comark-linter

pnpm add https://pkg.pr.new/comark-linter@431

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@431

comark-mark

pnpm add https://pkg.pr.new/comark-mark@431

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@431

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@431

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@431

comark-media

pnpm add https://pkg.pr.new/comark-media@431

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@431

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@431

comark-outline

pnpm add https://pkg.pr.new/comark-outline@431

comark-properties

pnpm add https://pkg.pr.new/comark-properties@431

comark-qr

pnpm add https://pkg.pr.new/comark-qr@431

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@431

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@431

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@431

comark-sources

pnpm add https://pkg.pr.new/comark-sources@431

comark-steps

pnpm add https://pkg.pr.new/comark-steps@431

comark-table

pnpm add https://pkg.pr.new/comark-table@431

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@431

comark-tests

pnpm add https://pkg.pr.new/comark-tests@431

comark-time

pnpm add https://pkg.pr.new/comark-time@431

comark-ui

pnpm add https://pkg.pr.new/comark-ui@431

comark-xref

pnpm add https://pkg.pr.new/comark-xref@431

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@431

commit: 023c458

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ComarkHtml with 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread packages/ui/src/vue.ts Resolved
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.
@onmax onmax changed the title feat(ui): ComarkHtml in comark-ui/vue shows rendered HTML and runs its scripts feat(ui): ComarkHtml shows rendered HTML in Vue and runs its scripts Nov 14, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ 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 ComarkHtml into comark-ui/html/vue, added its package export and build entry, and retained the comark-ui/vue re-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.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

@vite-hub

vite-hub Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Starting Not started —
View session Starting Not started —
View session Starting Not started —
View session Last seen running 2026-11-14T18:27:08.295Z 0s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 .nonce property 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.

Pullfrog  | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

@vite-hub
vite-hub Bot merged commit 08bbbe7 into main Nov 14, 2026
6 checks passed
@vite-hub
vite-hub Bot deleted the n8/html branch November 14, 2026 20:13
@github-actions github-actions Bot mentioned this pull request Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant