Skip to content

fix(ansi): pre hightlighting issue if line spans are missing - #384

Open
farnabaz wants to merge 1 commit into
mainfrom
fix/ansi-pre-highlighting-missing-line-spans
Open

fix(ansi): pre hightlighting issue if line spans are missing#384
farnabaz wants to merge 1 commit into
mainfrom
fix/ansi-pre-highlighting-missing-line-spans

Conversation

@farnabaz

@farnabaz farnabaz commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix ANSI pre highlighting when Shiki (or similar) emits token spans directly under code without span.line wrappers
  • Accept 3-digit hex colors in addition to 6-digit for --shiki-dark / color styles
  • This will fix rangi highlighting print in terminal

Test plan

  • Render a highlighted fenced code block via @comark/ansi where tokens lack span.line wrappers
  • Confirm token colors still apply when span.line wrappers are present
  • Confirm 3-digit hex colors (e.g. #abc) convert correctly to ANSI truecolor

Handle highlighted code where tokens are direct children of code
instead of nested under span.line, and accept 3-digit hex colors.
@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comark Ready Ready Preview Aug 24, 2026 11:49am
comark-json-render Ready Ready Preview Aug 24, 2026 11:49am
comark-nextjs Ready Ready Preview Aug 24, 2026 11:49am
comark-nuxt Ready Ready Preview Aug 24, 2026 11:49am
comark-svelte Ready Ready Preview Aug 24, 2026 11:49am
comark-sveltekit Ready Ready Preview Aug 24, 2026 11:49am
comark-twoslash Ready Ready Preview Aug 24, 2026 11:49am
comark-vue Ready Ready Preview Aug 24, 2026 11:49am

@pkg-pr-new

pkg-pr-new Bot commented Aug 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

npm i https://pkg.pr.new/comark@384

@comark/angular

npm i https://pkg.pr.new/@comark/angular@384

@comark/ansi

npm i https://pkg.pr.new/@comark/ansi@384

@comark/html

npm i https://pkg.pr.new/@comark/html@384

@comark/nuxt

npm i https://pkg.pr.new/@comark/nuxt@384

@comark/react

npm i https://pkg.pr.new/@comark/react@384

@comark/svelte

npm i https://pkg.pr.new/@comark/svelte@384

@comark/vue

npm i https://pkg.pr.new/@comark/vue@384

commit: 75884df

@github-actions

Copy link
Copy Markdown
Contributor

📦 Bundle size snapshot is out of date

The published size of one or more packages changed, so the inline snapshot in
test/bundle.test.ts no longer matches.

Please review the diff below. If the change is expected, accept the new snapshot:

  • 🔄 Update the bundle snapshot — tick this box and CI will run vitest run bundle --update and commit the result to this branch.

Update bundle snapshot

Only maintainers with write access can trigger the update. You can also comment /update-bundle-snapshot, or run it locally with pnpm prepack && pnpm vitest run bundle -u.

Bundle size diff
 FAIL  test/bundle.test.ts > package bundle size > published size of each package
Error: Snapshot `package bundle size > published size of each package 1` mismatched

- Expected
+ Received

@@ -1,8 +1,8 @@
  {
    "@comark/angular": "54.3k (70 files)",
-   "@comark/ansi": "39.9k (98 files)",
+   "@comark/ansi": "40.3k (98 files)",
    "@comark/html": "18.6k (58 files)",
    "@comark/nuxt": "11.8k (58 files)",
    "@comark/react": "43.6k (74 files)",
    "@comark/svelte": "43.9k (82 files)",
    "@comark/vue": "60.5k (78 files)",

 ❯ test/bundle.test.ts:61:20
     59|     }
     60|
     61|     expect(report).toMatchInlineSnapshot(`
       |                    ^
     62|       {
     63|         "@comark/angular": "54.3k (70 files)",

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

Full CI log

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