# Javascript ES6 template literals syntax for HTML

**URL:** <https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242>\
**Category:** Technical Support\
**Created:** [March 3, 2016, 11:35am UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242 "2016-03-03T11:35:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![50shadesOfColorBlind](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/50shadesofcolorblind/32/63941_2.png) [@50shadesOfColorBlind](https://forum.sublimetext.com/u/50shadesOfColorBlind)\
**Post date:** [March 3, 2016, 11:35am UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/1 "2016-03-03T11:35:35Z")

</div>

I am trying to have syntax highlighting for when I have some HTML wrapped by the backticks.  
Currently, looks like this:

 ![](https://forum.sublimetext.com/uploads/default/original/3X/c/0/c03b0a4a2afe5e131501b40c98de6f7ecb93f008.png)

A bit of context: this is an angular 1.5 component, with inline templating. I have the babel plugin and tried many different themes without success. ST3 3107.  
Help and thanks in advance.

---

<div class="post-metadata">

**Author:** ![subhaze](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/subhaze/32/43785_2.png) [@subhaze](https://forum.sublimetext.com/u/subhaze)\
**Post date:** [March 3, 2016, 3:42pm UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/2 "2016-03-03T15:42:34Z")

</div>

Here is a quick example of getting HTML highlighting working within template strings.

In ST just do: Tools \> Developer \> New Syntax

and paste the following from [very start of Angular 2 sublime syntax file · GitHub](https://gist.github.com/subhaze/a754c8d17906f2a25ce2)

That should get you started!

 ![](https://forum.sublimetext.com/uploads/default/original/3X/1/a/1a786c28faa82e2616b38df3e177b90c5451bc56.png)

---

<div class="post-metadata">

**Author:** ![50shadesOfColorBlind](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/50shadesofcolorblind/32/63941_2.png) [@50shadesOfColorBlind](https://forum.sublimetext.com/u/50shadesOfColorBlind)\
**Post date:** [March 3, 2016, 4:04pm UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/3 "2016-03-03T16:04:20Z")

</div>

Saved it has something.yaml . What am I missing here in order to activate it ?

---

<div class="post-metadata">

**Author:** ![subhaze](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/subhaze/32/43785_2.png) [@subhaze](https://forum.sublimetext.com/u/subhaze)\
**Post date:** [March 3, 2016, 4:24pm UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/4 "2016-03-03T16:24:25Z")

</div>

save it as .sublime-syntax

---

<div class="post-metadata">

**Author:** ![50shadesOfColorBlind](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/50shadesofcolorblind/32/63941_2.png) [@50shadesOfColorBlind](https://forum.sublimetext.com/u/50shadesOfColorBlind)\
**Post date:** [March 3, 2016, 6:30pm UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/5 "2016-03-03T18:30:07Z")

</div>

Worked! Thanks. Gonna integrate with Babel Sublime syntax now.

---

<div class="post-metadata">

**Author:** ![select\_](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/select_/32/63385_2.png) [@select\_](https://forum.sublimetext.com/u/select_)\
**Post date:** [October 31, 2016, 1:17pm UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/6 "2016-10-31T13:17:28Z")

</div>

Hey @subhaze the tip was great and it works but now the linter stopped working.

Is it possible to tell the linter that the new syntax is also JavaScript?

---

<div class="post-metadata">

**Author:** ![subhaze](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/subhaze/32/43785_2.png) [@subhaze](https://forum.sublimetext.com/u/subhaze)\
**Post date:** [November 1, 2016, 3:35am UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/7 "2016-11-01T03:35:34Z")

</div>

I’m not sure, I would think so but I don’t use linters within Sublime.

---

<div class="post-metadata">

**Author:** ![agoago](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/agoago/32/50382_2.png) [@agoago](https://forum.sublimetext.com/u/agoago)\
**Post date:** [December 10, 2016, 5:09am UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/8 "2016-12-10T05:09:47Z")

</div>

I tried this and it wouldn’t work.

Here is how I did it

I have 2 questions.

Where to save this file to?

How to actually activate this?

---

<div class="post-metadata">

**Author:** ![evenfrost](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/e/dbc845/32.png) [@evenfrost](https://forum.sublimetext.com/u/evenfrost)\
**Post date:** [February 3, 2017, 11:44am UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/9 "2017-02-03T11:44:59Z")

</div>

If you’re using SublimeLinter for linting, just add this syntax to `syntax_map` field in your SublimeLinter settings like this:

```json
{
  "user": {
    "syntax_map": {
      "javascript ng": "javascript"
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![select\_](https://forum.sublimetext.com/user_avatar/forum.sublimetext.com/select_/32/63385_2.png) [@select\_](https://forum.sublimetext.com/u/select_)\
**Post date:** [February 3, 2017, 4:27pm UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/10 "2017-02-03T16:27:32Z")

</div>

Thanks for the answer but it just does not seem to have an effect. Is there anything I can do to debug this?

---

<div class="post-metadata">

**Author:** ![evenfrost](https://forum.sublimetext.com/letter_avatar_proxy/v4/letter/e/dbc845/32.png) [@evenfrost](https://forum.sublimetext.com/u/evenfrost)\
**Post date:** [February 3, 2017, 4:54pm UTC](https://forum.sublimetext.com/t/javascript-es6-template-literals-syntax-for-html/18242/11 "2017-02-03T16:54:02Z")

</div>

Hmm, check your .sublime-syntax file for `name` field, and then put **lowercased** value of this field to `syntax_map` definitions in your SublimeLinter config. So, in my case:

```auto
# JavaScript (Tagged Templates.sublime-syntax)
name: JavaScript (Tagged Templates)

```

```auto
# SublimeLinter.sublime-settings
{
  "user": {
    # other settings...
    "syntax_map": {
      # other settings...
      "javascript (tagged templates)": "javascript"
    }
  }
}

```
