markup icon indicating copy to clipboard operation
markup copied to clipboard

Support ANSI colored text in code blocks.

Open motlin opened this issue 9 months ago • 3 comments

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

motlin avatar Mar 10 '25 14:03 motlin

Hoping GitHub will add this! Unfortunately I don't think this can actually be implemented within either markup or linguist, as explained here 😞

jenseng avatar Apr 17 '25 22:04 jenseng

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jun 17 '25 12:06 github-actions[bot]

not solved

simonvonhackewitz avatar Jun 23 '25 09:06 simonvonhackewitz

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 23 '25 12:08 github-actions[bot]

Pretty weird that jobs run with ansi colour support but there isn't any builtin way to get such ansi coloured results into the job summaries /re https://github.blog/news-insights/product-news/supercharging-github-actions-with-job-summaries/

balupton avatar Oct 25 '25 05:10 balupton

also closed at https://github.com/github/markup/issues/1538

balupton avatar Oct 25 '25 05:10 balupton