Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>HTML in JS templateNew to Visual Studio Code? Get it now.
HTML in JS template

HTML in JS template

DamagerS

|
163 installs
| (0) | Free
Highlighting of html code in js files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

HTML in JS Templates

HTML in JS Templates is a Visual Studio Code extension that provides syntax highlighting for HTML inside JavaScript template literals (backticks `).

🛠️ Features

  • HTML Syntax Highlighting:
    • Enables syntax highlighting for HTML code within JavaScript template literals.
    const htmlTemplate = `
         <div>
             <h1>Hello, World!</h1>
             <p>This is highlighted HTML!</p>
         </div>
    `;
    
  • Preserves JavaScript Highlighting:
    • JavaScript expressions inside template literals remain correctly highlighted.
    const message = `Result: ${1 + 2}`;
    

🛠️ Installation

  1. Open Extensions (Ctrl+Shift+X) in Visual Studio Code.
  2. Search for "HTML in JS Template".
  3. Click Install.
  4. Enjoy correct syntax highlighting for HTML inside your JavaScript files!

Alternatively, install it via the command line:

code --install-extension html-in-js-template

💨 Usage

The extension activates automatically when working with JavaScript files (.js) or TypeScript files (.ts), and when template literals (`) are detected.

Example:

const template = `
    <div>
        <h1>Title</h1>
        <p>HTML content is correctly highlighted!</p>
    </div>
`;
console.log(`Value: ${42}`);
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft