markdownsyntax-highlightinggitignorereadmegithub-linguist

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


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


Solution

  • For .gitignore there is no default linguist available, but 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 the default linguist.

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