How to apply color in Markdown?

后端 未结 11 990
情话喂你
情话喂你 2020-11-28 01:08

I want to use Markdown to store textual information. But quick googling says Markdown does not support color. Also StackOverflow does not support color. Same as in case of G

11条回答
  •  -上瘾入骨i
    2020-11-28 01:39

    While Markdown doesn't support color, if you don't need too many, you could always sacrifice some of the supported styles and redefine the related tag using CSS to make it color, and also remove the formatting, or not.

    Example:

    // resets
    s { text-decoration:none; } //strike-through
    em { font-style: normal; font-weight: bold; } //italic emphasis
    
    
    // colors
    s { color: green }
    em { color: blue }
    

    See also: How to restyle em tag to be bold instead of italic

    Then in your markdown text

    ~~This is green~~
    _this is blue_
    

提交回复
热议问题