Skip to content

Support ANSI colored text in code blocks. #1940

Open
@motlin

Description

@motlin

I would like to add support for rendering console logs containing ansi color codes using the actual colors.

I have files checked in with the *.log file extension. They are the actual console logs of a CLI that it emits during tests. Each test asserts that the console output exactly matches the contents of a specific output file. Since the CLI emits logs with color codes, these log files are readable from the console but not very readable in GitHub. [example]

I raised a similar request in Linguist and was redirected here, since Linguist does not manipulate text and would not strip out / replace the color codes.

There is a long thread on colors in markdown on #1440 which is a different feature. I saw the same feature requested there, but it's a bit buried in the comment chain.

I would like ANSI colored text in code blocks, i.e.

```ansi

[ANSI-formatted text with color escape codes]

```

which allows for pasting of ANSI terminal output, as one might obtain on Linux with

unbuffer <command with ANSI output> | xclip

I know Discord's Markdown has this feature. It's handy for when programs have colored output that makes it easier to find important details, such as errors, which is something GitHub is supposed to specialize in (software development)...

Originally posted by @Zi7ar21 in #1440

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