Skip to content

ANSI Escapes Converted to HTML Properties in Report #5774

Open

Description

@yan3ku

Would there be any interest in adding a built-in mechanism to automatically translate ANSI color codes into HTML/CSS styling in report files? (for example, via a new ansi=True argument to logger)?

Currently, capturing CLI outputs (like Ansible or Docker) clutters reports with raw escape codes unless they are stripped or parsed externally. I'm happy to implement this via a pull request, but wanted to check if this fits within the project's scope before writing the code.

Regards

Activity

  1. pekkaklarck commented on Sep 1, 2026

    @pekkaklarck
    Member

    Sounds useful! You idea is to add this argument to robot.api.logger functions like info, right? Probably then should add it also to BuiltIn.Log.

    I know there are external modules that could be used, but we don't want to have mandatory dependencies to make installation also without an Internet connection easy. Handling just color codes and possibly links in our own code base ought to be pretty easy, but we could implement this so that if a certain external module is installed, it is used instead.

  2. yan3ku commented on Sep 1, 2026

    @yan3ku
    Author

    Yes, Implementation in robot.api.logger and Builtin.Log as you suggested.

    I would approach this with simple regex parser that would convert "Select Graphic Rendition" (SGR) settings to HTML.
    The escape codes that would have to be converted are listed here:
    CSI Pm m Character Attributes (SGR): https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

    There are only few of them so the implementation should be lean.

  3. pekkaklarck commented on Sep 3, 2026

    @pekkaklarck
    Member

    Sounds good to me!

    Terminal hyper links could also be supported. There's only an informal spec, but they seem to be pretty widely supported and used. We added support for them in RF 7.1 (#5189).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions