Skip to content

Handling of ANSI foreground/background inversion is incorrect #2487

@tecosaur

Description

@tecosaur

As I've been doing a round of improvements to the StyledStrings docs, it occurred to me that it would be good to show some styled content. One of the examples I showed was with background colour. Documenter could obtain HTML representations of AnnotatedStrings with the show(::IO, ::MIME"text/html", ::AnnotatedString) method provided by StyledStrings (and I will make another issue on this), but for now I've tried using @repl; ansicolor=true blocks.

When used with styled"{magenta:some {inverse:inverse} text}", Documenter using an IO with :color would see \e[35msome \e[7minverse\e[27m text\e[39m and produces:

image

However, this is not correct. In the terminal one sees this:

image

and StyledStrings produces the following HTML:

<span style="color: #803d9b;">some </span><span style="background-color: #803d9b;">inverse</span><span style="color: #803d9b;"> text</span>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions