question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: Syntax Highlighting for HTML Template Strings

See original GitHub issue

Given 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:closed
  • Created 8 years ago
  • Reactions:17
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
DylanPierceycommented, Feb 27, 2017

Currently the atom babel syntax plugin allows for this but only if the tagged template function is called html - like so:

const it = html`
  <div>hi</div>
`

Also note that GitHub does the same.

2reactions
felipearosemenacommented, Apr 17, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found