Repository navigation
feat(badge): let users define their own badge style - #468
Conversation
style="custom" in the default preset reads radius, padding, border, font, labelText and valueText, keeps them in the image URL, and the badge builder gets a control for each.
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. |
There was a problem hiding this comment.
Important
Existing BadgeSpec objects can now generate badge URLs that the hosted endpoint rejects, even when they don’t use the new style.
Approach: Extending the shared badge parser and SVG renderer is the right way to keep Markdown, builder exports, and the hosted endpoint in sync, but the new options need to stay optional for existing callers.
Reviewed changes across comark-badge, the docs builder, and the public documentation.
- Badge options and rendering: Checked style selection, validation, SVG layout and contrast, and query serialization for local and hosted badges.
- Builder and documentation: Checked field visibility, link restoration, exports, and the component metadata, docs, and skill reference.
- Verification: The badge package built successfully, all 58 package tests and both Chromium tests passed, and focused checks reproduced the failures noted inline.
gpt-6.2-sol(high) | 𝕏
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: |
Latest result Pull request merged. Final answersSession Pull request merged. Session Merged 8fe2603 directly: required checks passed and review threads were resolved. PR #468 is ready to merge. All current-head checks passed, and the 63 badge tests passed locally. Lint exited successfully with warnings outside the changed files. I verified the fixes for legacy badge specs, invalid custom fields, and numeric URL serialization. All three review threads are resolved, and no new repair was needed. |
There was a problem hiding this comment.
✅ No new issues found. No P0 or P1 findings remain.
Reviewed changes since 4f00911:
- Restored compatibility for legacy
BadgeSpecobjects by making custom fields optional and omitting missing values from hosted URLs. - Validated custom fields before applying defaults, and normalized
radiusandpaddingso leading zeroes don’t carry over to hosted URLs. - Verified the fixes with a clean badge build and publint check, all 63 badge package tests, and both Chromium badge tests.
gpt-6.2-sol(high) | 𝕏

An image badge can only take one of three looks in the default preset: shadcn, subtle, or solid. A designer who wants square corners, a thin grey border, or mono text has to hand-draw the SVG, and the badge builder has no way to make it.
This PR adds
style="custom". It reads six new fields,radius(0 to 13),padding(4 to 16),border(a color ornone),font(sansormono),labelTextandvalueText, and keeps usinglabelColorandcolorfor the two halves. Text left without a color turns black or white for contrast, as solid does. Setting any of the fields pickscustomon its own, so:badge[ready]{radius="0"}is enough. The fields go in the image URL like every other option, so a hosted/badge.svglink and a builder link bring the same look back. The other presets ignore them, as they already ignorestyle. A bad value, or a custom field next to anotherstyle, is reported undercomark/badge/invalid-imagewith its fix. In the builder, choosing Style → Custom shows a field for each.Before and after of the builder at 1440px and 390px: https://drop.vitehub.dev/d/a360d38x2trs/before-after
Validation:
vp test run test/inpackages/badge: 58 passed. New cases cover the drawn SVG, the URL round trip throughbadgeParamsandreadBadge, each bad value's error, and markup in an unchecked value thatbadgeSvg()must not pass through.playwright test e2e/badge.e2e.ts: 2 passed. The new test sets a custom style in the builder, opens the builder link in a new page, and gets the same fields, export, and a 26px preview.vp lintand the root typecheck: nothing in the changed files. I didn't runpnpm ready, since the typecheck needs every package built.Not checked: a full docs build. The screenshots run the branch's builder markup, styles, and script inside the live docs page, not a local docs build.
🤖 Generated with Claude Code