github / markup

Determines which markup library to use to render a content file (e.g. README) on GitHub
MIT License
5.79k stars 3.41k forks source link

Color text in markdown #1440

Open jeppeutzon opened 3 years ago

jeppeutzon commented 3 years ago

@bkeepers : FYI people are continually asking for coloured text in this closed issue:

https://github.com/github/markup/issues/369

paquinmathieu commented 3 years ago

Hi, thank you for starting this new issue. I would absolutely appreciate that feature. Thank you

ddopson commented 3 years ago

+1000, which is a roughly accurate summation of six years worth of continuous +1 posts on issue #369, most of which weren't noticed due to that issue being closed for most of that time. (I'm exaggerating only slightly; the real number is 76 posts)

Please fix this and sunset one of my most popular StackOverflow questions (another +358 upvotes and counting): https://stackoverflow.com/questions/11509830/how-to-add-color-to-githubs-readme-md-file

Color is an important design feature for many CLI tools, including my underscore-cli tool for hacking on JSON data, and thus, it's important to be able to include properly colored output examples in the documentation.

Currently, the ONLY way to accomplish this is with a screenshot:

example.png

Screenshots are inferior to natively colored text. Beyond the minor inconveniences of being cumbersome to create / edit / maintain, and slower for browsers to load, screenshots thwart readers from copy/pasting key snippets of text, such as the command that was executed in the screenshot -- this makes the documentation less usable, and the potential work-arounds are all very ugly.

Another use-case from issue #369: There's a reason you support auto-colorization of code blocks --- coloring text is crucial for facilitating our eyes to parse it faster. However, there's no fallback story for tail languages and other structured text formats that aren't in your list.

Many, many projects would benefit from being able to tastefully color the structured text in their documentation.

GiuseppeChillemi commented 3 years ago

I am here to add my support to colorization in Markdown. Colors are an essential part of communication and we are in 2021, not in 1981 with monochrome displays.

xinye83 commented 3 years ago

+2147483647, we need this to happen!

aarakelian commented 3 years ago

Please, make colors happen!

dazdapertrakz commented 3 years ago

It is crucial indeed! It's been 7 years for god's sake...

avishnyakov commented 3 years ago

One of examples where color text in markdown is useful is Terraform plan reviews.

Consider attaching Terraform plan into GitHub tickets, issues or pull requests. Having TF plan is useful, makes it easier to review pull request, but.. it is plan text, no colors at all.

akloss-cibo commented 3 years ago

You can abuse the support for diff. I pipe it through this function (zsh/osx):

format_plan () {
    awk '
    /Terraform will perform the following actions:/ { found=1 }
    /------------------------------------------------------------------------/ { found=0 }
    // { if (found) { print $0 } }
  ' | (
        printf '<details><summary>Plan for %s</summary>\n\n```diff\n\n' "$1" && perl -pe 's/\x1b\[[0-9;]*[mG]//g' | sed -e 's/^\(  *\)\([\+-]\)/\2\1/' -e 's/^\(  *\)~/!\1/' && printf '```\n</details>'
    ) | pbcopy
}
SiddharthShyniben commented 3 years ago

At least, GitHub could create a custom attribute (<span data-color="red">Red</span>) for example. This would be great as you don't have to use style attributes anymore anymore. It would be easy to style these with some javascript.

Recap of two ~hacks~ methods provided to do this

Images

![Red text](http://placehold.it/size/background-hex/foreground-hex?text=a123)

Red text

Diffs

```diff
+ Green
- Red
! Orange
@@ Pink @@
# Gray
...

It's okay but no inline text I guess

And we also have those symbols. but we can disguise them by doing + Green + instead of + Green for example

Rikj000 commented 3 years ago

Idk what GitHub is waiting for, all IDE's I use support coloring in MarkDown..
The hacks described above "work", but should really not be considered as a "fix". The solution is way too dirty for that...
It's 2021 guys, we'd like some proper

+ C +
- O -
! L !
@@ O @@
# R #
S

please! :pray:

JAYD3V commented 3 years ago

Damn, I am surprised at how many people have been asking for color to be implemented into the GitHub markdown preview, and how long they have been asking for it w/o reply. When a company is new, they are so quick to cater to a customers needs, but when they get big like GitHub did, they can honestly care less. Its not that I think they should insert color into there markdown engine, but at the very least give a quick one liner reason as to why they won't implement color into MD rendering engine.

If I had to guess as to why they don't implement color, I would say it is because, they are the only one with black and white text & oversized headers. There markdown, generates a README view that is unique onto GitHub. Any of us can look at a dot MD document on GitHub, and know we are reading something in a GitHub repository. It is so unique and custom, that I see editor extensions that generate markdown in the same format as GitHub does. There MarkDown is a unique trademark of there site. Which makes since because I know that, (75% ) or more, of the time I spend in GitHub, is in my own, or someone else's, README.md documents. I believe they are MS now, which are like the contemporary marketing gurus.

EDIT: Just wanted to point out that using something like + some-text + - some-text - # some-text # * some-text *

wont work because most of the syntax you are suggesting is already being implemented in Markdown. You need something unused like:

$[1] SumText $

Where 1 equals a set of numbers ex(1-8) or (1-4) or whatever... each number is a different color. It would take some ingenuity to implement. Many of the commonly used shorthand's are alreadt being implemented in contemporary markdown.

Fabrizio-Caruso commented 2 years ago

Could you please some support for colored text in markdown?

4renginy commented 2 years ago

Yes color is important part of communication particularly if you are working on visual components. Please make it possible.

gomain commented 2 years ago

Yes, colors please.

emiltin commented 2 years ago

colors would be useful when discussing e.g. the output of RSpec, which uses colors a lot.

JAYD3V commented 2 years ago

Gosh Darn it GitHub, life is no fun without color! Please don't make us read black & white documentation for another 5 years. Give us something to zest our README docs up with. GitHub Markdown feels very archaic, quite honestly, visiting a GitHub README.md doc reminds me of watching I Luv Lucy, except I Luv Lucy was funny at least! Or, actually i just remembered that I Luv Lucy Wasn't funny, but you get the point. GitHub Docs needs color, please give us color, so GitHub stops looking like a 1950's throwback website from an alternate reality where the internet was invented 50 years earlier.

LauDijksterhuis commented 2 years ago

Doesn't have to be HTML tags, you are industry leaders if you think some other option is better. Just set the standard, I'm sure everyone is happy as long as we get colors ๐Ÿ˜ƒ

CelDaemon commented 2 years ago

maybe a custom extension to the markup language, that makes it possible to use different colors for light/dark/dimmed mode

alexey-milovidov commented 2 years ago

I need gray colored text to quickly differentiate from author's text and text left in issue/pull request template. Example: https://github.com/ClickHouse/ClickHouse/pull/26897

The text

By adding documentation, you'll allow users to try your new feature immediately, not when someone else will have time to document it later. Documentation is necessary for all features that affect user experience in any way. You can add brief documentation draft above, or add documentation right into your patch as Markdown files in docs folder.

has to have gray color.

PS. Maybe I will simply use quotation for that purpose.

asherhe commented 2 years ago

It's already 2021 and Github still insists on ignoring colors.

Why

ChicagoGupta commented 2 years ago

give me colors or give me death

chanukov commented 2 years ago

This makes me so sad that a feature which is one of the most basic features in any IDE/ is getting no love from Microsoft/github...

emiltin commented 2 years ago

Does GitHub not want to add colors, or is it more of a technical or resource issue?

panwarab commented 2 years ago

@Github should Hoist the colours like a true pirate.

perlygatekeeper commented 2 years ago

Can we can an answer to this issue please?

ChristianMertes commented 2 years ago

It's already 2021 and Github still insists on ignoring colors.

"Already 2021"? I see you're also feeling this:

fuqz3nuzkdg71

PaulM5406 commented 2 years ago

It would be very nice feature to have !

SiddharthShyniben commented 2 years ago

I think GitHub could allow adding classes ({.class#id}), and then style those classes as necessary. This could allow us to add colored text via text {.red}, and this could open doors for a whole lot of stuff (## h2 {.important}, | Table | Header | {.striped}, ![Image](url) {.centered}, [link](link) {.button}, text {.font-handwriting})

marcelino-borges commented 2 years ago

Common, Github! Consider started an official campaign for

LET MARKDOWN COLORS HAPPEN!

React to this to call their attention!

SiddharthShyniben commented 2 years ago

```diff - Colors please! - ```

```diff +( Just give us colors! )+ ```

wagnerbsouza commented 2 years ago

don't mind me...I'm just another one CRAVING FOR COLORS IN MY README AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA PLEASE!!!!!

โค๏ธ โ˜ฎ๏ธ ๐ŸŒˆ

KyleKolander commented 2 years ago

I'll add my +1 here.

This whole thing seems really odd.

  1. The original issue was closed by @bkeepers (no longer at GitHub?) less than 10 days after it was opened, without providing a means for the community to follow the progress of the request. Where is the transparency?
  2. It's been almost 7 years since the original request and almost 7 months since this request opened, with no update or explanation from the GitHub team.
  3. This is a highly requested feature.
  4. There are easy solutions to this problem.

I agree with @W3Dojo:

at the very least give a quick one liner reason as to why they won't implement color into MD rendering engine.

GitHub team - pretty safe assumption you have your reasons for not implementing this feature request, but your lack of response is in stark contrast to your Customer Obsessed leadership principle.

jeppeutzon commented 2 years ago

Hello Github-staff-people. There is a much requested feature that has gone unnoticed or ignored for years (see above). Not sure who is the right person to alert, so I'm just tagging a few of you and then you can fight it out yourselves. :)

@ashtom @colebemis @dipree @eileencodes @mdo @izuzak @homeles @kdaigle @leereilly @lukehefson

dipree commented 2 years ago

@jeppeutzon looks like I won ๐ŸฅŠ we will have a look. Thanks for bringing it to our attention.

davips commented 2 years ago

[This] is the Frankenstein screenshot-based README of my project. If it is a matter of github keeping the trademark of B&W (like said by other commenter), I suppose this kind of ugly solution certainly defeats it by large.

kellycastrof commented 2 years ago

Is there any other option other than diff? ๐Ÿ˜ž

- red
+ green

I don't like the idea of adding an extra character for the color: -, +, etc.

ChristianMertes commented 2 years ago

Is there any other option other than diff? ๐Ÿ˜ž

- red
+ green

I don't like the idea of adding an extra character for the color: -, +, etc.

There are other similar kludges (see above) but no proper solution. I don't think any sane person likes the idea of using these kinds of hacks.

dnck commented 2 years ago
(ยด._.`)\(โ€˜ฬโŒฃโ€™ฬ€ ) Colored text will come one day son, one day...
lzkill commented 2 years ago

Hey, Github... Colors are cool.

emiltin commented 2 years ago

I've sometimes missed the ability to use colors in markdown or readme files, but frankly it's easy to use colors too much. If everyone could color their readme files any way they like, I'm not sure I would enjoy browsing repositories in GitHub as much as I do now. The result might be a rather messy experience.

Maybe colors should be limited syntax highlighting? What I miss is the ability to show a terminal session with colors. Of course this could easily be abused and turn into a hack to color your readme..

kellpossible commented 2 years ago

It would be great to be able to have colors so we can at least manually render ansi color escape codes to be displayed on github

haoliangz commented 2 years ago

LOVE COLORS

GiuseppeChillemi commented 2 years ago

Please, Color Me!

jyotirmaybarman commented 2 years ago

give us colorrrrrrr

emiltin commented 2 years ago

@dipree did you find out anything with your team?

dipree commented 2 years ago

@emiltin we are still investigating. But it's very likely that we won't open the flood gates to define any color. We support multiple themes on GitHub and want to make sure that colored text in Markdown is accessible in any theme. It's unfortunately quite easy to exclude certain groups from being able to access text once it has a fixed color. For instance, when choosing a white font while in dark mode all those on a light theme won't be able to read it. We believe that the most inclusive option is to allow the usage of functional variables. So, rather than describing the exact color, a user would be able to use text color utilities. For example "success" which is defined as #1a7f37 on the "Light" theme and #0566d5 on "Light protanopia". We haven't yet decided on whether or when we will allow to color text in Markdown, but we are actively looking into this and will keep you posted with any updates.

Do you think allowing a subset of colors but making it accessible to anyone would cover most of your use cases?

emiltin commented 2 years ago

Hi @dipree, thank you for providing a status, that's appreciated. I personally think it makes a lot of sense to allow functional variables rather than any fixed colors; themes being one good reason. Syntax coloring in text editors (or websites) follows a similar pattern: You define certain colors and when they are used, rather than fixed colors. The use-case of showing a terminal session with color in the output might deserve special consideration. For example, how would you (or should you) illustrate a terminal session running the rspec command with some tests being green and others red?

StaticPH commented 2 years ago

I feel like having access to the named colors in HTML for both foreground and background would be plenty for most people, but I certainly understand the concern when theme coloration come into play.

samveen commented 2 years ago

I suggest adding a requirement of 16 colors to each theme "titled" color_1 to color_16 similar to how 4-bit ANSI color codes are implemented in terminal emulators with themes, keeping in mind that most colors in editors follow the same source and convention.

Zagoshipda commented 2 years ago

We definitely need color ....!!!!!