feat: Syntax Highlighting for HTML Template Strings
See original GitHub issueGiven HTML content in an ES6 template string, e.g.:
let template = `
<div class="row">
<div class="col-md-4">
<p>Hello there!</p>
</div>
</div>
`
…syntax highlight the HTML as if it was stand-alone in a .html file.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:17
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Syntax Highlight JavaScript Template Strings - Joy of Code
Syntax highlight, and code completion inside JavaScript template strings.
Read more >es6-string-html - Visual Studio Marketplace
Adds syntax highlight support for code, placed in es6 multiline strings: HTML (incl. html quoted and unquoted attrs); SQL; XML; SVG; CSS; GLSL ......
Read more >ES6 Template Literals (Template Strings) - CanIUse
Template literals are string literals allowing embedded expressions using backtick characters (`). You can use multi-line strings and string interpolation ...
Read more >Only JavaScript gets template strings' syntax highlighting
html -in-template-string. Of course, I know well that Markdown is the only another language that have non-parent language syntax highlighting ...
Read more >Easy Creation of HTML with JavaScript's Template Strings
Another feature of template literals or template strings is the ... use these multiline strings when I'm creating HTML markup as a string....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Currently the atom babel syntax plugin allows for this but only if the tagged template function is called html - like so:
Also note that GitHub does the same.
I know this is closed, but would like to +1 this request.
Wouldn’t it be possible to parse the content between backticks as html and then the expressions inside
${}
as js?It seems to me that would make sense, after all aren’t template literals supposed to make easier to work with HTML within JS? Proper syntax highlighting would be a huge bonus for this.