Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applying color in a Markdown file on GitHub [duplicate]

Can I, in some way, color Markdown content?

I'm putting this in a gist on GitHub and was wondering if I could in some way color specific parts in my .md file. I’m pretty sure the .md file does support some HTML, but I’m not fully certain. If it does support coloring with HTML, how would that be done? If so, can I also change the font?

like image 397
VideoCarp Avatar asked Sep 04 '25 16:09

VideoCarp


1 Answers

In general you can include arbitrary HTML in your Markdown, but there's no guarantee that the renderer will honour it all. For example:

Hi here is some text <span style="color: red">this is red</span>.

renders on SO to:

Hi here is some text this is red.

Although all of the text is included, the span gets stripped out entirely:

<p>Hi here is some text this is red.</p>

Similarly, it looks like GitHub strips the styling out (it's "sanitized, aggressively" - it leaves the span, at least, but removes the style attribute, see Gist):

<p>Hi here is some text <span>this is red</span>.</p>
like image 155
jonrsharpe Avatar answered Sep 07 '25 17:09

jonrsharpe