如何突出显示README.md的.gitignore代码? [英] How can I highlight .gitignore code for my README.md?

查看:65
本文介绍了如何突出显示README.md的.gitignore代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个README.md,其中包含部分代码,我想用正确的颜色突出显示这些部分.

其中一个代码是 .gitignore代码,我想将其集成到我的 README.md 中.但是我无法为此提供出色的语言亮点,例如以绿色将我的评论涂成彩色.

我已经搜索了GFM检测到的某些语言,但对结果不满意.

有人可以帮我找到优秀的语言学家吗?

P.S.:我也想问一个DockerFile,在REAMDE代码中突出显示docker-compose.

谢谢,MushuLeDragon

解决方案

对于 .gitignore ,没有可用的默认语言学家,因为 sh 是最接近的匹配项,因此您可以使用那个.

示例: https://gist.github.com/binki/7e0710d92863276ba39091cb299725bd

对于 DockerFile docker-compose 使用 dockerfile 语言学家.这是默认的语言学家.

 ```dockerfile来自golang:1.10-alpine3.8ENV NAME示范ENV SOURCEROOT/go/src/github.com/${NAME}复制 .$ {SOURCEROOT}WORKDIR $ {SOURCEROOT}......``` 

I wrote a README.md with parts of code and I want to highlight those parts with the right colors.

One of this code is a .gitignore code, that I would like to integrate to my README.md. But I can't have the good linguist highlight for this, which colorize in green my comments for example.

I have searched some languages detected by GFM but I am not satisfied by the results.

Can someone help me to find the good linguist ?

P.S. : I also want to question for a DockerFile, docker-compose in a REAMDE code highlight.

Thanks, MushuLeDragon

解决方案

For .gitignore there is no default linguist available by sh is the closest match so you can use that.

Example: https://gist.github.com/binki/7e0710d92863276ba39091cb299725bd

And for DockerFile, docker-compose use dockerfile linguist. It's default linguist.

```dockerfile
FROM golang:1.10-alpine3.8
ENV NAME demo
ENV SOURCEROOT /go/src/github.com/${NAME}
COPY . ${SOURCEROOT}
WORKDIR ${SOURCEROOT}
...
...
```

这篇关于如何突出显示README.md的.gitignore代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆