To enable HTML syntax validation within Handlebars templates in Sublime Text 2, follow similar instructions to http://stackoverflow.com/questions/5578472/amend-html-grammar-based-on-attributes-in-textmate.
<body> <script type="text/x-handlebars" data-template-name="todos"> <section id="todoapp"> <!-- ... --> </section> </script> </body>
Even with ST2 plugins such as sublime-text-handlebars, the HTML code still would not be presented as HTML (and you had to change the syntax of the file to Handlebars, removing ALL HTML syntax validation). Ideally we would keep the HTML file syntax as HTML.
%APPDATA%/Sublime Text 2/Packages/HTML/HTML.tmLanguage and change:
<dict> <key>begin</key> <string>(?:^s+)?(<)((?i:script))b(?![^>]*/>)</string> <key>beginCaptures</key>
<dict> <key>begin</key> <string>(?:^s+)?(<)((?i:script))b(?!([^>]*text/x-handlebars[^>]*|[^>]*/>))</string> <key>beginCaptures</key>
The change will be instant; to see if it works, try commenting out a block (Ctrl-/) within a
(I don’t know if there is a better place to put this that won’t be overridden by updates yet.)