Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Dec 4, 2025

Summary

Fixes #1185

Logs containing ANSI escape sequences (colors, bold, italic, etc.) are now properly styled in the UI instead of showing raw escape characters.

image

Changes

  • Added anser library for ANSI parsing
  • Created AnsiText component that:
    • Parses ANSI escape codes into styled spans
    • Maps ANSI colors to Tailwind CSS classes
    • Handles formatting (bold, italic, underline, strikethrough)
  • Updated LogsList and LogDetail to use the new component
  • Added comprehensive unit tests for the AnsiText component
  • Added test fixture with meaningful ANSI escape codes

Before/After

Before: Logs showed raw escape sequences like \u001b[32m✓\u001b[0m
After: Logs display properly colored and formatted text

Testing

  • ✅ 9 unit tests passing for AnsiText component
  • Tested with various ANSI color codes and formatting options

Added AnsiText component that parses ANSI escape sequences and renders
them with proper Tailwind CSS styling. This makes logs with colors,
bold, italic, and other formatting display correctly instead of showing
raw escape characters.

- Added anser library for ANSI parsing
- Created AnsiText component with color and formatting support
- Updated LogsList and LogDetail to use AnsiText
- Added unit tests for AnsiText component
- Added test fixture with ANSI escape codes

Fixes #1185
@vercel
Copy link

vercel bot commented Dec 4, 2025

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

Project Deployment Preview Comments Updated (UTC)
spotlightjs Ready Ready Preview Comment Dec 4, 2025 6:10pm

@BYK BYK deployed to Preview December 4, 2025 18:09 — with GitHub Actions Active
@BYK BYK requested a review from MathurAditya724 December 4, 2025 18:27
@BYK BYK merged commit 3fe91ca into main Dec 4, 2025
21 of 22 checks passed
@BYK BYK deleted the byk/fix/log-ansi-characters branch December 4, 2025 19:04
BYK pushed a commit that referenced this pull request Dec 4, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @spotlightjs/[email protected]

### Patch Changes

- Fix ANSI escape code rendering in log viewer. Logs containing ANSI
escape sequences (colors, bold, italic, etc.) are now properly styled in
the UI instead of showing raw escape characters.
([#1187](#1187))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

Spotlight logs don't parse ANSI escape codes

3 participants