asbjornenge / Docker.tmbundle

Dockerfile syntax
MIT License
75 stars 27 forks source link

Only highlights if first line is `FROM` directive #45

Closed znxftw closed 1 week ago

znxftw commented 1 week ago

Hi there! Went down a bit of a rabbit hole to reach here to find the root cause of an issue I was facing - needed some understanding on how this package works and what is expected.

zola uses this theme to highlight markdown text in dockerfiles.

I noticed when writing codeblocks that if I wanted to show a snippet of a dockerfile - e.g. only the RUN command, it wasn't getting highlighted.

So to try and find the root cause, I reached here - I've never really used Sublime before this but installed it and got this package to test out.

Looks like even if I explicitly set the file type in Sublime to be 'Dockerfile' it doesn't recognise the syntax until I add a 'FROM' directive (I'm aware that Dockerfile itself has the restriction that the first line needs to be FROM, but does that require the highlighting to also slip away?)

image image

Is this the expectation? If I named my file Dockerfile (or atleast set the language on the bottom right corner), shouldn't it automatically highlight any and all syntax? Have I misconfigured something? Quite new to the whole world of sublime-syntax so bear with me a bit if this is a silly question!

princemaple commented 1 week ago

It is expected. A valid Dockerfile starts with one of the followings:

  1. comment
  2. ARG
  3. FROM