Keith
Keith

Reputation: 21224

Color-code HTML in script templates

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?

Upvotes: 0

Views: 760

Answers (1)

Matthew
Matthew

Reputation: 25743

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.

Upvotes: 3

Related Questions