63

From what I read here, and here; I expected there would be syntax highlighting for Dockerfile files.

But I've tried it to apply highlighting to one answer of mine here, but it never shows.

I've tried using both docker and dockerfile as language hints, with the same (lack of) results.

(Just realized that on the question the asker attempted it using Dockerfile as language hint, but again, no visible results).

After helpful prodding by rene, I realized that the language is not currently supported from the list that's posted within the corresponding post in uber-meta.

Following advice from zcoop98, I've also tried using lang-dockerfile and lang-docker, but the results appear to be hit-and-miss: enter image description here

But maybe that's the intended result, and my expectations are the problem.

This is now a request that this highlighting is enabled, and if it's actually enabled and what I see when using lang-docker is what we got... well, to see if we can get anything better than that.

We have hats. Now we need more variously coloured source-code files.

7
  • 2
    No docker here: meta.stackexchange.com/a/184109/158100
    – rene
    Dec 16, 2020 at 10:19
  • Oh, I just went to the link with the "list of highlight.js supported languages", and I assumed (incorrectly) that if it was there it should work. I guess I should turn this into a request so that it gets enabled?
    – yivi
    Dec 16, 2020 at 10:21
  • 2
    Yeah, but don't have high hopes, certainly not in the 6 to 8 weeks timeframe. Possible related/useful: meta.stackexchange.com/questions/355233/… Cross site dupe: meta.stackexchange.com/questions/355494/…
    – rene
    Dec 16, 2020 at 10:22
  • 5
    Another note- using "docker" or "dockerfile" as the language hint will actually tell the highlighter to look to those respective tags for the language hint. Neither has a highlighter language assigned to it, so it's no different than "lang-default", which is the highlighter's best guess for language. In the future, to specify a certain language in particular, use the "lang-" prefix for language hints to specify a language, eg. "lang-docker" or "lang-dockerfile".
    – zcoop98
    Dec 16, 2020 at 16:34
  • 3
    @zcoop98 Curiously lang-dockerfile produces some highlighting. Not a particularly nice one, though.
    – yivi
    Dec 16, 2020 at 17:22
  • 4
    Since Dockerfiles are usually mostly shell commands, I manually mark them as lang-sh. That doesn't highlight the Docker keywords, but it's definitely less random than the default.
    – David Maze
    Dec 17, 2020 at 12:07
  • 9
    [Highlight.js maintainer here] Pretty sure Docker is another one of the grammars we DO support quite well, but SE choses not to bundle because of size/speed considerations. Feb 15, 2021 at 2:39

0

You must log in to answer this question.

Browse other questions tagged .