Is there any way to get HTML syntax highlighting working for JsRender templates (as part of an aspx file) in Visual Studio 2010?
My aspx files typically look like this:
<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Test._Default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript" src="Scripts/jsrender.js"></script>
<script type="text/javascript" src="Scripts/Default.js">
</head>
<body>
<script id="defaultTemplate" type="text/x-jsrender">
<div>
<table>
<thead>
<tr>
<th>Customername</th>
<th>Contact</th>
<th>Url</th>
<th>Details</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
{{for CustomerData}}
<tr>
<td>{{>Name}}</td>
<td>{{>Contact}}</td>
<td>{{>Url}}</td>
<td>Click</td>
<td>Click</td>
</tr>
{{/for}}
</tbody>
</table>
<div id="navContainer">Next</div>
</div>
</script>
</body>
There is no support for JsRender syntax highlighting in VS 2010, but if you have VS 2012, there is a a Web Essentials plugin which adds syntax highlighting within script blocks (of type other than text/javascript). It also provides hightlighting on {{foo }} tags.
In a future release it will likely be built in…
The Web Essentials plugin download is here
Update: VS 2012 and VS 2013 now include syntax highlighting for JsRender tempates.