Skip to content

[highlights] Add ANSI terminal highlighting - #1241

Merged
ije merged 4 commits into
mainfrom
ije/highlights-ansi
Oct 30, 2026
Merged

ije merged 4 commits into
mainfrom
ije/highlights-ansi

Conversation

@ije

@ije ije commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Add lang: 'ansi' support to HTML, token, and streaming APIs, including terminal colors, backgrounds, and text styles. Parsing stays in JavaScript; Wasm is unchanged. LiveTokenizer preserves raw input.

ANSI token output honors tokenizeMaxLineLength: capped lines become one unstyled token, escape sequences are removed, and SGR state carries into subsequent lines, including when streaming.

All 75 themes define 16 terminal.ansi.* colors from pinned upstream sources or documented editor defaults. ANSI output uses these palettes, and CSS variables use names such as --hls-terminal-ansi-red. See palette sources.

codeToHtml('\x1b[31mError\x1b[0m', { lang: 'ansi', theme });
codeToTokens('\x1b[31mError\x1b[0m', { lang: 'ansi', theme });

Fixes #1228

@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
pierre-diffshub Ready Ready Preview Oct 29, 2026 3:44am UTC
pierre-docs-diffs Ready Ready Preview Oct 29, 2026 3:44am UTC
pierre-docs-trees Ready Ready Preview Oct 29, 2026 3:44am UTC
pierrejs-diff-demo Ready Ready Preview Oct 29, 2026 3:44am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T03:49:53.789804Z 6579e58 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 861ce3c61e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/highlights/lib/highlighter.ts Resolved
@ije

ije commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review again

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 6579e58103

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ije ije changed the title feat(highlights): add ANSI terminal highlighting [highlights] Add ANSI terminal highlighting Oct 30, 2026
@ije
ije merged commit 2a18971 into main Oct 30, 2026
8 checks passed
@ije
ije deleted the ije/highlights-ansi branch October 30, 2026 00:51

This branch was successfully deployed

4 active deployments
Preview – pierre-docs-diffs — 6579e581 Deployed Oct 29, 2026 by vercel[bot]
Preview – pierre-diffshub — 6579e581 Deployed Oct 29, 2026 by vercel[bot]
Preview – pierrejs-diff-demo — 6579e581 Deployed Oct 29, 2026 by vercel[bot]
Preview – pierre-docs-trees — 6579e581 Deployed Oct 29, 2026 by vercel[bot]
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.

[highlights] 146 Shiki languages have no lexer (prisma, ini, dotenv, ansi, ...)

1 participant