Repository navigation
feat(preset): draw Mermaid diagrams with comark-pele - #165
Conversation
Registers comark-pele in every preset entry under the `mermaid` option, on by default, and maps Pele's --pele-* variables to the shared --comark-* tokens so diagrams follow the page's light and dark theme.
Codex Review SummaryThis 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. |
Latest result Pull request merged. Final answersSession Pull request merged. Session Waiting for GitHub merge request 9ecff3ac-5fc6-430d-9a9d-5527e65a32b0. Session Command failed: git -C /home/workspace/babysitter-data/tmp/vitehub-provider-uert8c update-index --no-skip-worktree -- AGENTS.md fatal: Unable to mark file AGENTS.md Session Command failed: git -C /home/workspace/babysitter-data/tmp/vitehub-provider-uert8c update-index --no-skip-worktree -- AGENTS.md fatal: Unable to mark file AGENTS.md Session Command failed: git -C /home/workspace/babysitter-data/tmp/vitehub-provider-uert8c update-index --no-skip-worktree -- AGENTS.md fatal: Unable to mark file AGENTS.md Session Command failed: git -C /home/workspace/babysitter-data/tmp/vitehub-provider-uert8c update-index --no-skip-worktree -- AGENTS.md fatal: Unable to mark file AGENTS.md Session Command failed: git -C /home/workspace/babysitter-data/tmp/vitehub-provider-uert8c update-index --no-skip-worktree -- AGENTS.md fatal: Unable to mark file AGENTS.md Session Command failed: git -C /home/workspace/babysitter-data/tmp/vitehub-provider-uert8c update-index --no-skip-worktree -- AGENTS.md fatal: Unable to mark file AGENTS.md Session Command failed: git -C /home/workspace/babysitter-data/tmp/vitehub-provider-uert8c update-index --no-skip-worktree -- AGENTS.md fatal: Unable to mark file AGENTS.md Session Command failed: git -C /home/workspace/babysitter-data/tmp/vitehub-provider-uert8c update-index --no-skip-worktree -- AGENTS.md fatal: Unable to mark file AGENTS.md |
|
make sure to add it in our docs as well, even though they are not our pacakge, it is compeltetly ok! |
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac2e6a4997
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
comark-annotate
comark-badge
comark-cards
comark-carousel
comark-cast
comark-charts
comark-chips
comark-cjk
comark-code
comark-code-notes
comark-colors
comark-critic
comark-deflist
comark-details
comark-diagrams
comark-diff
comark-embed
comark-fields
comark-figure
comark-file-tree
comark-footnotes
comark-github
comark-icon
comark-include
comark-keys
comark-links
comark-linter
comark-mark
comark-media
comark-metrics
comark-outline
@onmax/comark
comark-properties
comark-qr
comark-quiz
comark-reading-time
comark-sources
comark-steps
comark-table
comark-tabs
comark-tests
comark-xref
comark-zoom
commit: |
comark-pele is third-party, so its pages sit in docs/pages/mermaid/. thirdParty in docs/examples.ts maps the slug to its npm name, so the rail, the playground presets, and the landing canvas treat it like a package without a folder in packages/. The preset's Mermaid section keeps only the option and the bundle cost and links to the new pages.
There was a problem hiding this comment.
Important
The Mermaid integration is functionally sound, but the new theme bridge has two concrete cascade/token regressions that should be fixed before merging.
Reviewed changes
- Preset registration — Reviewed the new
comark-peleregistration andmermaidoption across the HTML, Vue, React, and Svelte preset entries. - Rendering lifecycle — Reviewed HTML style deduplication and framework SSR/client takeover through Pele's renderer components.
- Theme bridge — Reviewed the new
mermaidCssmappings, card styles, and their interaction with Comark's shared theme tokens. - Coverage — Reviewed the added preset tests, package exports, dependency updates, workspace catalog, and documentation changes.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
No new issues were introduced by the incremental documentation commit, but the two prior theme regressions remain unresolved and still need correction before merging.
Reviewed changes
- Added Mermaid documentation pages — Added the third-party Mermaid rail entry, getting-started, syntax, and theming pages, with examples discovered by the docs catalog.
- Extended docs cataloging — Updated page resolution, package metadata handling, and example discovery so
docs/pages/mermaid/is treated as a third-party plugin without requiring a package directory. - Moved the preset Mermaid example — Kept the preset page focused on configuration and linked the dedicated Mermaid documentation.
- Updated docs framing — Added
.pele-diagramto the self-framing class allowlists.
The docs build could not be executed in this read-only checkout: pnpm docs:build failed during the workspace prepare step because vp config could not lock .git/config, and the direct node docs/build.ts fallback lacked generated workspace exports (packages/critic/node_modules/comark-zoom/dist/theme.mjs).
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
The incremental fix still does not preserve inherited --pele-* theme overrides because the fallback declarations are self-referential CSS custom properties.
Reviewed changes
- Added third-party linter loading — Added optional
comark-peleloading and disabled Mermaid in the preset used by linting, avoiding competing handlers. - Added Mermaid documentation — Added the dedicated Mermaid pages and third-party docs catalog support, including examples, theming, and setup guidance.
- Adjusted theme fallback declarations — Replaced the ring token with the border token and attempted to preserve host Pele variables through fallback expressions.
Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:
packages/preset/src/client.ts:500(RIGHT) — line 500 (RIGHT) is not inside a diff hunk
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
The latest theme fallback rewrite still masks inherited --pele-* overrides on .pele-diagram and must be corrected before merging.
Reviewed changes
- Repaired Mermaid linter loading — Disabled Mermaid in the preset used by linting and loaded
comark-peleseparately so Mermaid fences remain parsed without duplicate handlers. - Reworked Mermaid theme defaults — Replaced the self-referential fallback declarations and retained the corrected
_comark-bordermapping.
Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:
packages/preset/src/client.ts:505(RIGHT) — line 505 (RIGHT) is not inside a diff hunk
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
The latest commits add the preset skill bundle and documentation, but the existing Mermaid theme contract issue remains unresolved.
Reviewed changes
- Added the preset skill bundle — Copied
skills/comark-pluginsinto the published preset and added the corresponding export path. - Updated preset documentation — Replaced the versions section with the agent-skill guidance; no Mermaid runtime behavior changed in this delta.
- Rechecked the Mermaid integration — Revalidated the current full PR state, including the linter registration, renderer entries, HTML style injection, and theme bridge.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
The latest theme fallback change still breaks the preset's documented shared-token theming and should be corrected before merging.
Reviewed changes
- Moved Pele defaults to the root — Changed the Mermaid CSS bridge from diagram-local
--pele-*declarations to a:where(:root)rule intended to preserve inherited host overrides. - Extended the HTML assertion — Updated the preset test to check for the new root-level mapping while retaining coverage for one-time style injection and disabling Mermaid.
Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:
packages/preset/src/client.ts:505(RIGHT) — line 505 (RIGHT) is not inside a diff hunk
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
The latest theme fallback rewrite still breaks descendant dark/shared-token themes for Mermaid SVGs and should be corrected before merging.
Reviewed changes — Reviewed the delta since the prior Pullfrog review, specifically the root-level Pele fallback rewrite and its updated token documentation and assertions.
- Moved Pele defaults to
:where(:root)— Attempted to preserve inherited host--pele-*overrides while retaining Comark token fallbacks. - Updated token documentation and coverage — Replaced the ring-token description and asserted the root-level fallback output in the preset test.
gpt-5.6-sol | 𝕏
|
Verified Pullfrog: P1 theme cascade defect. Root-level Pele defaults resolve shared tokens before descendant |
Main renamed the project to comark-ui (#169). The preset bullet in AGENTS.md keeps this branch's comark-pele sentence and takes main's renamed skill path.

Agents write Mermaid better than any other diagram language, but the preset couldn't draw it, so the comark-plugins skill had no Mermaid to offer. This registers comark-pele (MIT, 1.1.0) in every
@onmax/comarkentry. It turns```mermaidfences into SVG with Pele, and the preset maps Pele's colors to the shared--comark-*tokens.What changes
onmax({ mermaid })is on by default.falseleaves the fences as code, and an object goes to comark-pele ({ languages }). It's registered in the HTML, Vue, React, and Svelte entries.src/client.ts(new@onmax/comark/clientexport) holdsmermaidCss. It resolves the tokens withcomark-zoom/themeon.pele-diagram, maps them onto--pele-*, and puts each diagram on a card like comark-diagrams'. Accent falls back to--primaryand then the foreground, critical to--destructive, and series colors to--comark-chart-N/--chart-Nwith comark-charts' palette.createPeleComponent({ onRender: addMermaidStyles }): Pele callsonRenderonly in the browser, aftermount(), so no wrapper component is needed. The Svelte types didn't need to change becauseindex.d.tsre-exportsPresetOptions.docs/style.csslists.pele-diagramamong the classes that draw their own frame. AGENTS.md describes the new piece./mermaid/: an overview with flowchart, sequence, and pie examples (now playground presets), Getting started (through the preset or comark-pele alone), Syntax (fences, the diagram types, failures), and Theming (tokens,--pele-*, classes). The pages say plainly that comark-pele is a third-party plugin by farnabaz, and the footer credits comark-pele and Pele.Docs for a plugin outside
packages/The docs build assumed every rail entry is a package under
packages/with apackage.json. comark-pele isn't ours, so its pages sit indocs/pages/mermaid/, andthirdPartyindocs/examples.ts({ mermaid: "comark-pele" }) maps the slug to its npm name. That's the only new concept.docs/build.tslistsmermaidinpackageOrderafterdiagrams,fileOfsends athirdPartyslug todocs/pages/, and its npm name comes from the map instead of apackage.json.docs/examples.tsalso globsdocs/pages/<slug>/*.mdfor each one, so its examples become presets. The rail, the playground, the landing canvas, the installer's "Only comark-pele" switch, and Doctor's link check all work unchanged. No skill is offered for it, since no package folder holds one.Checks run before writing preset code
render()drew all 22 types I tried: flowchart, sequence, class, state, ER, gantt, pie, mindmap, timeline, gitGraph, journey, quadrant, xychart, sankey, requirement, C4, block, architecture, kanban, packet, radar, and treemap.--pele-bg,-fg,-muted,-line,-surface,-surface-alt,-border,-accent,-font,-radius,-series-1..8), read from the SVG's inline style, so CSS on an ancestor themes it without drawing it again. In the screenshot it follows.darkwith shadcn's variables. I also checkedprefers-color-scheme: darkwith no variables set, which uses comark-zoom/theme's fallback.render()ran in Node withdocumentandwindowundefined, and the full@onmax/comark/htmlbundle drew two diagrams inside workerd (Miniflare 4,nodejs_compat). The bundle has noevalornew Function.document,ResizeObserver, andOffscreenCanvasappear only inmount(), which only the Vue, React, and Svelte components call, in the browser.pele/lazy. Bundled with esbuild for a Worker, the HTML entry goes from 2,103,731 to 2,803,061 bytes minified, and from 722 KB to 982 KB gzip (+699 KB min, +260 KB gzip; comark-pele itself is 1.7 KB of that). That's still under Workers' 3 MB compressed limit on the free plan. The docs mention the cost andmermaid: false.Verification
pnpm readypasses: format, build with publint, check, 76 test files (1162 passed, 1 expected fail), and Vite Doctor.mermaid: falseleaves the fence as code.svelte/serverin a scratch script. The repo has no Svelte test harness.docs/build.ts, serveddocs/dist, and checked/mermaid/and its Getting started page in light and dark. The playground'smermaid-*presets draw throughdocs/plugins.tswith the Mermaid styles.Not in this PR
mainyet, so SKILL.md andreferences/preset.mddon't have their Mermaid entries. Add them when feat(preset): one agent skill, comark-plugins, with a reference for every package #158 lands, or after this merges.data-error. It doesn't add tometa.issues, so comark-linter doesn't flag broken Mermaid. Reporting it would need a parse-time check, a lint rule, and a doctor page, so I left it for a follow-up.