Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
7e112e3 to
01cd6cc
Compare
01cd6cc to
b157051
Compare
Summary: Let trusted custom tokenizers attach a narrow inline presentation to syntax tokens. Styled tokens automatically use the span renderer while CodeBlock keeps its source-faithful DOM and clipboard value. Test Plan: - pnpm exec vitest run packages/core/src/CodeBlock/CodeBlock.test.tsx packages/core/src/CodeBlock/tokenizer.test.ts --root . - pnpm --filter @astryxdesign/core typecheck - pnpm --filter @astryxdesign/core typecheck:docs - pnpm --filter @astryxdesign/core build - pnpm check:repo - pnpm visual:probe-theme:check
b157051 to
cfe1747
Compare
|
@cixzhang — I’d appreciate your feedback on this draft. Focus: Trusted CodeBlock tokenizers can attach bounded literal styles while exact source text remains the DOM and clipboard value. This is PR 15/20 in the linked Markdown stack. It is intentionally one commit and one primary intent; the description includes focused functional evidence and previous/next links, so you can review just this PR’s delta. |
humbertovirtudes
left a comment
There was a problem hiding this comment.
The implementation is small and preserves source text correctly, but it expands the stable tokenizer API with an exported style type and new rendering precedence without current CodeBlock authority. Please land a design-only contract covering why per-token styling is public, the allowed property set, when styles force span rendering, and the theming and accessibility guarantees. Then rebase this change and add a package-level public type and import test.
PR Analysis Report
Modified ComponentsOutline (@astryxdesign/core)
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression4 of 422 shot(s) changed. A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | View full report |
User need
Trusted CodeBlock tokenizers can attach bounded literal styles while exact source text remains the DOM and clipboard value.
Problem and solution fit
Class-only token styling cannot represent engines that return per-token colors without either global CSS generation or source-replacing markup. A narrow style field keeps presentation metadata separate from source fidelity.
Current specification
CodeBlock's trusted-tokenizer and source-fidelity contracts, supporting AST-039 renderers. Pinned source.
Public delta and caller burden
Add validated
SyntaxToken.stylesupport for bounded color/font-style/font-weight/text-decoration values; invalid styles fail closed and token offsets must remain safe and non-overlapping.Design and alternatives
The capability is explicit and opt-in where it changes syntax, rendering, or package weight. Existing defaults and replacement seams remain compatible; broader alternatives stay outside this PR.
Evidence
Functional evidence
This change is intentionally nonvisual; a pixel comparison would be misleading.
Focused behavior and compatibility coverage ships with the implementation.
Scope
Testing
pnpm exec vitest run packages/core/src/Markdown packages/core/src/CodeBlock— 37 files, 760 tests.pnpm --filter @astryxdesign/core typecheck.pnpm check:repo.Stack
Previous: #6669 · Next: #6671 · Each PR is intentionally one commit and one primary intent.