Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get HTML syntax highlighting inside PHP strings & heredoc syntax?

I'm using Sublime Text with the Pastels on Dark theme. My language of choice is PHP. How can I get HTML syntax highlighting inside PHP strings & heredoc syntax?

like image 414
Glyph Avatar asked Aug 20 '13 14:08

Glyph


People also ask

How do you highlight text in PHP?

The highlight_string() function outputs a string with the PHP syntax highlighted. The string is highlighted by using HTML tags. The colors used for syntax highlighting can be set in the php. ini file or with the ini_set() function.

How do you highlight code in HTML?

The <mark> tag in HTML is used to define the marked text. It is used to highlight the part of the text in a paragraph.


1 Answers

Name your heredocs after the language you are using. This will syntax highlight in many text editors, including Sublime Text.

For example:

echo <<<HTML
<!-- put HTML here and it will have syntax highlighting -->
HTML;
like image 134
Glyph Avatar answered Oct 07 '22 21:10

Glyph