feat: implement badge/pill component with |Label|{.variant} syntax#23
Merged
Conversation
Adds inline badges for status labels, counts, and filter chips.
Parser detects |Label| and |Label|{.variant} in both plain and rich-content
paragraphs; renderers (HTML, React, Tailwind) and all 7 CSS styles updated.
Includes 23 new tests and docs updated across SKILL.md, syntax references,
QUICK-REFERENCE.md, SYNTAX-SPEC, and guide.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #21
Summary
|Label|and|Label|{.variant}— pipe-delimited inline badgessuccess·warning·error·primary· (none = neutral gray)Status: |Active|{.success}), and as multiple pills on one lineImplementation
src/parser/transformer.ts— detects|...|in both plain and rich-content paragraphs; variant classes promoted toprops.variantsrc/renderer/html-renderer.ts/react-renderer.ts/tailwind-renderer.ts—renderBadge()added to eachsrc/renderer/styles.ts— badge CSS added to all 7 styles (sketch has border + rotation; brutal has square border + box-shadow; material uses chip style; tailwind uses full-radius pill)Tests (+23)
tests/parser.test.ts— 6 badge parsing teststests/renderer.test.ts— 5 HTML rendering teststests/react-renderer.test.ts— 3 React rendering teststests/tailwind-renderer.test.ts— 5 Tailwind rendering teststests/edge-cases.test.ts— 7 edge cases (empty||, spaces in label, unknown variant, HTML escaping, all-styles smoke)Docs
QUICK-REFERENCE.md— added to component table, disambiguation rules, and tipsSYNTAX-SPEC-v0.1.md§7.4 — replaced unimplemented backtick spec with actual|Label|spec + parser rules + table-cell limitationdocs/guide/syntax.md— new Badges/Pills sectionclaude-skill/SKILL.md— badge line in quick referenceclaude-skill/references/syntax.md— new Badges/Pills section + component mapping rowExample
|Active|{.success} |Pending|{.warning} |3|{.error} |New|{.primary} Status: |Active|{.success}Pre-rendered examples in
examples/pills-test-*.htmlfor all 7 styles.🤖 Generated with Claude Code