How to add color to Github's README.md file
I have a README.md file for my project underscore-cli, a pretty sweet tool for hacking JSON and JS on the command-line.
I want to document the "--color" flag ... which ... colors things. That would go over a lot better if I could actually show what the output looks like. I can't seem to find a way to add color to my README.md. Any ideas?
I've tried this:
<span style="color: green"> Some green text </span>
And this:
<font color="green"> Some green text </font>
No luck so far.
It's worth mentioning that you can add some colour in a README using a placeholder image service. For example if you wanted to provide a list of colours for reference:
- ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) `#f03c15`
- ![#c5f015](https://placehold.it/15/c5f015/000000?text=+) `#c5f015`
- ![#1589F0](https://placehold.it/15/1589F0/000000?text=+) `#1589F0`
Produces:
#f03c15
#c5f015
#1589F0
您可以使用diff
语言标记生成绿色和红色突出显示的文本:
```diff
+ this will be highlighted in green
- this will be highlighted in red
```
You cannot color plain text in a GitHub 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.
No "pre" or "code" tags needed.
This is covered in the GitHub Markdown documentation (about half way down the page, there's an example using Ruby). GitHub uses Linguist to identify and highlight syntax - you can find a full list of supported languages (as well as their markdown keywords) over in the Linguist's YAML file.
链接地址: http://www.djcxy.com/p/20176.html