Sublime Forum

[Solved] highlight HTML in PHP strings

#1

I was wondering if there is a way to still have HTML syntax being highlighted when putting it directly into PHP?


As you can see when putting the HTML into the PHP markup it loses the color syntax and this does it with all color themes i’ve tried.

0 Likes

#2

HTML syntax in PHP works fine. What you are asking is for HTML syntax highlighting inside a PHP string. This is something quite different. You would need to edit your PHP syntax file to call in the HTML syntax for strings. This would not be that reliable. This is because you are also using HTML fragments in separate strings getting strung together. I personally think it is unrealistic to expect HTML syntax highlighting in PHP string fragments.

0 Likes

#3
0 Likes

#4

seeing as this thread has been bumped, I’ll add my 2 cents:

You can use heredoc syntax to get HTML highlighted inside PHP:

0 Likes

Plugin that supports multiple syntax in a scope