Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>HTML in JS (somenoe's fork)New to Visual Studio Code? Get it now.
HTML in JS (somenoe's fork)

HTML in JS (somenoe's fork)

somenoe

|
7 installs
| (0) | Free
A simple VSCode extension that adds HTML highlighting inside JS template literals
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

HTML in JS - VS Code Extension

Forked from https://github.com/DeusCL/html-in-js

This extension enables HTML syntax highlighting inside JavaScript template literals when using the /* HTML */ comment and enables Emmet abbreviations.

Features

  • HTML syntax highlighting in template literals
  • Support for Emmet abbreviations
  • Works in .js and .html files
  • Support for JavaScript interpolation inside HTML (${variable})
  • Use the /* HTML */ comment to enable Prettier formatting with HTML Template Support
  • Supports case-insensitive; e.g., /*html*/, /* html */, /*HTML*/, /* HTML */

Usage

In JavaScript files (.js)

const element = /* HTML */ `
  <div class="container">
    <h1>Hello World</h1>
    <p>This text is also highlighted as HTML</p>
  </div>
`;

In HTML files with script tags

<script type="module">
  const element = /* HTML */ `
    <div class="container">
      <h1>Hello World</h1>
      <p>This text is highlighted as HTML</p>
    </div>
  `;
</script>

In order to see emmet abbreviation suggestions you must have to setup the <script> tag as <script type="module">.

Using ${variables} inside the /* HTML */ template literal

<script type="module">
  const Component = (title, text, class="container") = /* HTML */ `
    <div class="${class}">
      <h1>${title}</h1>
      <p>${text}</p>
    </div>
  `;

  document.body.innerHTML += Component("Hello World", "This text is highlighted as HTML");
</script>
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft