Skip to content

fix(ansi): apply conceal and faint style attributes when rendering text - #568

Open
troclaux wants to merge 2 commits into
charmbracelet:mainfrom
troclaux:fix/conceal-style-applied
Open

fix(ansi): apply conceal and faint style attributes when rendering text#568
troclaux wants to merge 2 commits into
charmbracelet:mainfrom
troclaux:fix/conceal-style-applied

Conversation

@troclaux

@troclaux troclaux commented Jun 3, 2026

Copy link
Copy Markdown

Problem

The conceal field of StylePrimitive was being parsed from style JSON but never applied to the ANSI output. Text remained fully visible even when conceal: true was configured (e.g. on link or link_text styles).

All other style attributes (bold, italic, underline, blink, etc.) were already applied — conceal was simply missing from the chain.

Fix

Add a rules.Conceal check in renderText, consistent with how all other style attributes are applied:

if rules.Conceal != nil && *rules.Conceal {
    style = style.Conceal(true)
}

Test

Added styles/examples/conceal_link test fixture: a link rendered with "link": {"conceal": true}. The golden file confirms that the URL is wrapped in \x1b[8m (the ANSI conceal sequence).

Fixes #121

@troclaux troclaux changed the title fix(ansi): apply conceal style attribute when rendering text fix(ansi): apply conceal and faint style attributes when rendering text Jun 3, 2026
troclaux added 2 commits June 2, 2026 21:06
The Conceal field of StylePrimitive was parsed from style JSON but never
applied to the ANSI output. Text remained visible even when conceal: true
was set (e.g. on link or link_text styles).

Fixes charmbracelet#121
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.

conceal property on links in style JSON

1 participant