PHP syntax highlighting: startinline is not working

Hello there,
I am currently working on rebuilding my blog with Hugo but recently hit a wall with syntax highlighting.

Currently I have some PHP code on my blog and wanted to highlight it with the built-in syntax highlighter but it does not recognize PHP without the <?php opening tag. The thing is that such a tag does not make sense for 90% of the snippets. So I searched the web and found this Chroma issue where someone mentions the startinline option and the maintainer closed the issue. I assume that Chroma is able to highlight inline PHP with that option.

The issue: the startinline option is not recognized.

I have the following code snippets available:

{{< highlight php >}}
{{< / highlight >}}

{{< highlight php "startinline=true" >}}
{{< / highlight >}}


All three do not work and and are output as blank text. As written in the Hugo docs, I should be able to configure the highlighter globally. So I edited my config as follows:

pygmentsCodeFences = true
pygmentsUseClasses = true
pygmentsOptions = "hl_lines=3,startinline=1"

Note on the pygmentsOptions part: to test this option I added the config to highlight line 3, which is performed correctly so I assume that the options are passed to the highlighter.

My question is: what am I doing wrong here? Is this an issue with Hugo being incorrectly configured, could this be a bug with Chroma?
I am pretty lost at the moment. :frowning:

It’s not currently supported with Chroma. The Chroma php lexer doesn’t support a startinline option. You’ll have to add a starting <?php tag or use Pygments.