Moody
Moody

Reputation: 164

HTML syntax highlighting, formatting, and emmet snippets in Javascript?

I'm trying to edit HTML in a Javascript file using template string literals but I'm unable to get all the same features like I would in an HTML file.

return (template string quotes) <p>Hello World</p> (template string quotes)

I've tried using extensions and the syntax highlighting works but formatting with prettier and emmet snippets doesn't work:

div#idName or div.className or ul>li*3 all don't work.

WebStorm has syntax highlighting and emmet snippets but no formatting. However, I'd prefer using VS Code. If anyone knows a solution I'd be extremely grateful!

Edit: I'm using Vanilla Javascript.

Upvotes: 0

Views: 1178

Answers (1)

Moody
Moody

Reputation: 164

I've solved emmet snippets in JS by editing the VS Code Emmet Include Languages settings.

YouTube: Enable emmet abbreviations in any language

Using an extension for syntax highlighting (lit-html or es6-string). Only thing I couldn't figure out is code formatting with Prettier for the html inside JS. Will update if I do.

Upvotes: 2

Related Questions