Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show ANSI colors on Github README.md

I want to convert this ugly string...

"\e[0;92;49mGroup::Item\e[0m | \e[0;35;49mgender\e[0m\n  \e[0;92;49mGroup::SubItem\e[0m | \e[0;36;49mage=22 \e[0m\e[0;94;49mfirst_name=\"Juan Manuel\" \e[0m\e[0;36;49msite_id=1 \e[0m\e[0;94;49mstore_id=1 \e[0m\e[0;36;49mgender=\"M\" \e[0m\e[0;94;49msavings=20.5 \e[0m\n    \e[0;93;49mSource::Item\e[0m | \e[0;36;49mage=22 \e[0m\e[0;94;49mfirst_name=\"Juan Manuel\" \e[0m\e[0;36;49msite_id=1 \e[0m\e[0;94;49mstore_id=1 \e[0m\e[0;36;49mgender=\"M\" \e[0m\e[0;94;49msavings=20.5 \e[0m\n    \e[0;93;49mSource::Item\e[0m | \e[0;36;49mage=31 \e[0m\e[0;94;49mfirst_name=\"Leandro\" \e[0m\e[0;36;49msite_id=1 \e[0m\e[0;94;49mstore_id=1 \e[0m\e[0;36;49mgender=\"M\" \e[0m\e[0;94;49msavings=15.5 \e[0m\n    \e[0;93;49mSource::Item\e[0m | \e[0;36;49mage=65 \e[0m\e[0;94;49mfirst_name=\"Rodolfo\" \e[0m\e[0;36;49msite_id=2 \e[0m\e[0;94;49mstore_id=2 \e[0m\e[0;36;49mgender=\"M\" \e[0m\e[0;94;49msavings=50.2 \e[0m\n    \e[0;93;49mSource::Item\e[0m | \e[0;36;49mage=8 \e[0m\e[0;94;49mfirst_name=\"Francisco\" \e[0m\e[0;36;49msite_id=2 \e[0m\e[0;94;49mstore_id=3 \e[0m\e[0;36;49mgender=\"M\" \e[0m\e[0;94;49msavings=2.5 \e[0m\n    \e[0;93;49mSource::Item\e[0m | \e[0;36;49mage=31 \e[0m\e[0;94;49mfirst_name=\"Gustavo\" \e[0m\e[0;36;49msite_id=3 \e[0m\e[0;94;49mstore_id=4 \e[0m\e[0;36;49mgender=\"M\" \e[0m\e[0;94;49msavings=40.5 \e[0m\n    \e[0;93;49mSource::Item\e[0m | \e[0;36;49mage=35 \e[0m\e[0;94;49mfirst_name=\"Javier\" \e[0m\e[0;36;49msite_id=3 \e[0m\e[0;94;49mstore_id=5 \e[0m\e[0;36;49mgender=\"M\" \e[0m\e[0;94;49msavings=25.5 \e[0m\n  \e[0;92;49mGroup::SubItem\e[0m | \e[0;36;49mage=64 \e[0m\e[0;94;49mfirst_name=\"Susana\" \e[0m\e[0;36;49msite_id=2 \e[0m\e[0;94;49mstore_id=2 \e[0m\e[0;36;49mgender=\"F\" \e[0m\e[0;94;49msavings=30.0 \e[0m\n    \e[0;93;49mSource::Item\e[0m | \e[0;36;49mage=64 \e[0m\e[0;94;49mfirst_name=\"Susana\" \e[0m\e[0;36;49msite_id=2 \e[0m\e[0;94;49mstore_id=2 \e[0m\e[0;36;49mgender=\"F\" \e[0m\e[0;94;49msavings=30.0 \e[0m\n    \e[0;93;49mSource::Item\e[0m | \e[0;36;49mage=33 \e[0m\e[0;94;49mfirst_name=\"Virginia\" \e[0m\e[0;36;49msite_id=2 \e[0m\e[0;94;49mstore_id=3 \e[0m\e[0;36;49mgender=\"F\" \e[0m\e[0;94;49msavings=70.1 \e[0m\n    \e[0;93;49mSource::Item\e[0m | \e[0;36;49mage=33 \e[0m\e[0;94;49mfirst_name=\"Gabriela\" \e[0m\e[0;36;49msite_id=3 \e[0m\e[0;94;49mstore_id=4 \e[0m\e[0;36;49mgender=\"F\" \e[0m\e[0;94;49msavings=45.5 \e[0m\n"

into this beautiful and shiny table

enter image description here

Obviously, I don't want to use images...

How can I do this?

like image 775
Leantraxxx Avatar asked Jul 19 '15 16:07

Leantraxxx


People also ask

How do I add color to a README.md file?

You can however add color to code samples with the tags below. To do this just add tags such as these samples to your README.md file: ```json // code for coloring ``` ```html // code for coloring ``` ```js // code for coloring ``` ```css // code for coloring ``` // etc.

How do I change font color in GitHub?

You can use the ```diff```` language tag to generate red (and green) highlighted text.

Can you use CSS in GitHub readme?

GitHub does not allow for CSS to affect README.md files through CSS for security reasons (as if you could inject CSS into a ReadMe, you could easily launch a phishing attack). This includes both stylesheets referenced through <link rel> and inline styles used with <style> .

How do I highlight text in GitHub Markdown?

You can also create a Markdown hyperlink by highlighting the text and using the keyboard shortcut Command + V .


1 Answers

This is not possible. GitHub Markup uses html-pipeline to sanitize any HTML, removing anything that you might use to color text, including:

  • style elements
  • style attributes
  • font elements

Note that the color attribute is still available, however this is not much good because it requires the font element.

If you wish to add color support, voice your support for the open issue at the html-pipeline repo.

like image 187
Zombo Avatar answered Sep 19 '22 12:09

Zombo