Color-code HTML in script templates

761 Views Asked by At

I've been using script tags for javascript templates like this. (This example uses Handlebars.js but many other templating engines follow the same convention.)

<script id="template" type="text/x-handlebars-template">
    <div>
        <span>{{ title }}</span>
    </div>
</script>

Visual Studio does not color code the HTML inside the <script> tag. Is there a way to do that?

1

There are 1 best solutions below

0
On BEST ANSWER

If the type does not need to be explicitly text/x-handlebars-template, you can use text/html instead. Visual Studio understands this is meant to be interpreted as HTML and will thus color code it appropriately.