Skip to content

feat(charts): add comark-charts, charts drawn from Markdown tables that agents read as data - #44

Merged
vitehub-bot[bot] merged 6 commits into
mainfrom
feat/charts
Oct 21, 2026
Merged

vitehub-bot[bot] merged 6 commits into
mainfrom
feat/charts

Conversation

@onmax

@onmax onmax commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Adds comark-charts. A Markdown table inside ::chart becomes an SVG chart, and the table stays under it, so agents read the numbers.

::chart{title="Build time (ms)"}
| month | before | after |
| --- | --: | --: |
| 2026-04 | 820 | 610 |
| 2026-05 | 890 | 622 |
:::annotation{at="2026-05" series="before" mark="circle"}
The slow month.
:::
::
::chart
  readChart     → problems go in meta.issues, never throws
  Flint         → Vega-Lite spec, shadcn-like theme
  Vega          → SVG on the server, no script, runs on Workers
  <figure>      → chart + annotate marks + <details> Data table

Types: bar, stacked, line, area, scatter, dumbbell, waterfall, pie.

Also:

  • comark-annotate exports readMark and annotateHtml.
  • comark-lint loads charts and puts their issues on the right line.

Checks: pnpm ready (194 tests), plus e2e/charts.e2e.ts, which renders 296 worst-case charts and fails on any colliding or clipped text.

Upstream fixes: microsoft/flint-chart#147, vega/vega#4373.

Before release: add a trusted publisher for comark-charts on npmjs.com.

@vitehub-bot

vitehub-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Waiting 2026-10-21T05:43:08.215Z 6m 17s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

View session

Verified HEAD and all current checks are green. Pullfrog’s prior P1 marked-chart zoom-context finding is fixed: `.cch-plot` is preserved in zoom clones. No actionable findings remain. Focused local Vitest was blocked by the protected `.git/config` prepare hook; `git diff --check` passed.

Session

Fixed Pullfrog P1: zoomed marked charts now retain the enclosing `.cch-plot` context, preserving theme colors and sizing. Pushed commit b0f0343 and resolved the review thread. `git diff --check` passed; local Vitest was unavailable because pnpm prepare requires writing protected `.git/config`. Awaiting current-head checks.

Session

Fixed Pullfrog P1: zoomed marked charts now retain the enclosing `.cch-plot` context, preserving theme colors and sizing. Pushed commit b0f0343 and resolved the review thread. `git diff --check` passed; local Vitest was unavailable because pnpm prepare requires writing protected `.git/config`. Awaiting current-head checks.

Session

Fixed Pullfrog P1: zoomed marked charts now retain the enclosing `.cch-plot` context, preserving theme colors and sizing. Pushed commit b0f0343 and resolved the review thread. `git diff --check` passed; local Vitest was unavailable because pnpm prepare requires writing protected `.git/config`. Awaiting current-head checks.

Session

Fixed Pullfrog P1: zoomed marked charts now retain the enclosing `.cch-plot` context, preserving theme colors and sizing. Pushed commit b0f0343 and resolved the review thread. `git diff --check` passed; local Vitest was unavailable because pnpm prepare requires writing protected `.git/config`. Awaiting current-head checks.

Session

Fixed Pullfrog P1: zoomed marked charts now retain the enclosing `.cch-plot` context, preserving theme colors and sizing. Pushed commit b0f0343 and resolved the review thread. `git diff --check` passed; local Vitest was unavailable because pnpm prepare requires writing protected `.git/config`. Awaiting current-head checks.

Session

Fixed Pullfrog P1: zoomed marked charts now retain the enclosing `.cch-plot` context, preserving theme colors and sizing. Pushed commit b0f0343 and resolved the review thread. `git diff --check` passed; local Vitest was unavailable because pnpm prepare requires writing protected `.git/config`. Awaiting current-head checks.

Session

Fixed Pullfrog P1: zoomed marked charts now retain the enclosing `.cch-plot` context, preserving theme colors and sizing. Pushed commit b0f0343 and resolved the review thread. `git diff --check` passed; local Vitest was unavailable because pnpm prepare requires writing protected `.git/config`. Awaiting current-head checks.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ b0f0343 2026-10-21T05:34:05.006Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 56e8c59 2026-10-21T04:49:26.727Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 7a6338f 2026-10-21T04:44:47.358Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 42587e9 2026-10-21T04:31:04.662Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ fc091fb 2026-10-21T04:18:05.795Z Visit the dashboard ↗

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/onmax/comark-plugins/comark-annotate@44

comark-carousel

pnpm add https://pkg.pr.new/onmax/comark-plugins/comark-carousel@44

comark-charts

pnpm add https://pkg.pr.new/onmax/comark-plugins/comark-charts@44

comark-embed

pnpm add https://pkg.pr.new/onmax/comark-plugins/comark-embed@44

comark-github-callouts

pnpm add https://pkg.pr.new/onmax/comark-plugins/comark-github-callouts@44

comark-include

pnpm add https://pkg.pr.new/onmax/comark-plugins/comark-include@44

comark-lint

pnpm add https://pkg.pr.new/onmax/comark-plugins/comark-lint@44

comark-tabs

pnpm add https://pkg.pr.new/onmax/comark-plugins/comark-tabs@44

comark-zoom

pnpm add https://pkg.pr.new/onmax/comark-plugins/comark-zoom@44

commit: b0f0343

@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

Marked charts lose chart theming and sizing when opened in the zoom view.

Reviewed changes

This review covers the two commits adding comark-charts, the shared annotation helpers, chart validation and SVG rendering, docs and skill discovery, lint integration, and the chart test coverage.

  • Chart package — Adds Markdown-table parsing, validation, server-side Flint/Vega SVG drawing, chart-specific CSS, and data-preserving HTML output.
  • Chart annotations — Anchors comark-annotate marks to Vega scenegraph shapes and reuses the annotation zoom/runtime renderer.
  • Repository integration — Registers the package in docs, lint, workspace dependencies, and agent skill discovery.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/charts/src/html.ts Outdated
onmax added 2 commits October 21, 2026 06:30
… and trim the SVG

Vega compiled its expressions with new Function, which Workers forbid, so every chart fell back to its table there; it now uses vega-interpreter. Flint, Vega-Lite, and Vega load on the first chart, so importing comark-charts/html (and comark-lint) takes ~65 ms instead of ~285 ms. The SVG drops Vega's per-mark ARIA labels and group roles, which the root role=img hides, empty foreground paths, and float noise in coordinates; plain bars no longer stack, which gave every bar a clipped group. A 40-bar chart goes from 64 kB to 34 kB of SVG and draws in half the time.
…rouped bar its lane

Without a canvas Vega guessed every character at 0.8em, so greedy overlap hid labels that fit, such as a waterfall step's; it now guesses per grapheme through textMetrics.width. Flint scaled text from 13.5px down to 8px with the plot and ignored the theme, so axes, legends, and value labels are set to 12px. Flint's local dodge found the band from the column's semantic type, so grouped bars over dates were laned by value and some drew zero wide; grouped bars use the global dodge.

@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 in the incremental changes. The remaining open zoom-context concern from the prior review is unchanged and is not repeated here.

Reviewed changes

This review covers the changes since the prior Pullfrog review: Cloudflare-safe Vega interpretation, lazy chart drawing, SVG cleanup, and additional layout and accessibility adjustments.

  • Enabled interpreted Vega execution — Parsed the compiled spec as an AST and supplied vega-interpreter so server-side rendering does not depend on new Function.
  • Deferred chart dependencies — Moved drawing behind a dynamic import so parsing and documents without charts avoid loading Flint and Vega.
  • Refined chart output — Disabled redundant SVG accessibility roles, removed empty foreground paths and float noise, and adjusted bar stacking and layout behavior.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

@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 label-width heuristic can make the rendered chart keep labels that overlap, or truncate labels that fit, for scripts and font shaping it does not model.

Reviewed changes

This review covers the two commits since the prior Pullfrog review: Vega text measurement and typography adjustments, plus grouped-bar lane layout and its regression test.

  • Refined label measurement — Replaced Vega's no-canvas character-count estimate with grapheme-based width guesses and fixed chart label sizes.
  • Adjusted grouped bars — Forced grouped bars to use global series lanes and added coverage for grouped bars over date-like x values.
  • Retained server-safe rendering — Kept the interpreter-backed Vega path and the existing SVG cleanup while changing text layout decisions.

Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:

  • packages/charts/src/draw.ts:1194-1195 (RIGHT) — line 1195 (RIGHT) is not inside a diff hunk

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

@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 in this delta. The duplicate-x bar adjustment preserves the intended visibility of invalid input rows; this review is non-approving because an earlier Pullfrog finding remains unresolved.

Reviewed changes

This review covers the single commit since the prior Pullfrog review: preserving visibility for invalid repeated-x bar rows.

  • Preserved duplicate bar rows — Kept stacking enabled when repeated x values are present, so duplicate rows are rendered instead of one being hidden behind another.
  • Kept valid grouped-bar behavior — Retained stack removal for unique x values and the existing grouped-bar lane behavior.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

@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 in the incremental changes. The previously reported marked-chart zoom-context issue remains open and unchanged, so this review does not approve the PR.

Reviewed changes

This review covers the changes since the prior Pullfrog review: text measurement and label sizing, global grouped-bar lane assignment, and duplicate-x bar stacking.

  • Improved label measurement — Estimated widths by grapheme and applied consistent 12px chart text sizing so fitting labels are retained without clipping.
  • Assigned grouped-bar lanes globally — Prevented date-based grouped bars from collapsing into zero-width lanes.
  • Preserved repeated-x bars — Kept repeated x values stacked while retaining the parser's diagnostic for duplicate rows.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

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

Reviewed changes

This review covers the change since the prior Pullfrog review: preserving chart context when a marked chart is opened in the zoom view.

  • Preserved marked-chart zoom context — Passed .cch-plot through annotateHtml into data-zoom-context, so zoomed chart clones retain the chart's theme substitutions and marked-chart sizing rules.

Pullfrog  | View workflow run | Using gpt-5.6-sol | 𝕏

@vitehub-bot
vitehub-bot Bot merged commit 6174475 into main Oct 21, 2026
9 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 20, 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