Sublime Text: in HTML links having PHP snippets, ampersands highlight red?

html, php, sublimetext2

Solution

Within an `href` attribute, ampersand characters should be represented by its HTML entity `&`, otherwise the HTML validator will complain. Sublime Text correctly marks a single `&` without an entity as erroneous.

See also What other characters beside ampersand (&) should be encoded in HTML href/src attributes? and Do I encode ampersands in <a href...>?

Problem

I'm writing what I understand to be pretty standard PHP/HTML code. Imitating a rough RESTful architecture, inspired by Rails, in PHP. My pages contain lots of dynamically generated links that are structured like this: ``` <a href='objects_list.php?coursekey=<? echo $coursekey; ?>&delete_section=<? echo $row['key']; ?>'>delete</a> ``` As you can see, the link has two URL variables, each of which is set based on PHP variables that the page knows about. Pretty common, right? I recently moved to Sublime Text 2 as my primary development environment. I think it's fantastic and my development process is much improved. But Sublime's syntax highlighting seems to get confused by the ampersands (&) that separate URL variables in any links. It highlights each ampersand in red as though thinking I made an error. Any idea why? Any way to make Sublime recognize that links often need to have ampersands in them? EDIT: This happens whether or not PHP fragments are contained in the link href. Sublime just seems to mistrust ampersands in links...?

Original source

Related problems