How can I highlight .gitignore code for my README.md?

只愿长相守 提交于 2021-02-05 11:14:36

问题


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


回答1:


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}
...
...
```


来源:https://stackoverflow.com/questions/52402063/how-can-i-highlight-gitignore-code-for-my-readme-md

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!