Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight html syntax inside string?

Is there a way (plugin, option, or tip and trick) to highlight html syntax in a js string?

My document is .JS file, in which I use strings containing html code. Is it possible highlight html syntaxe inside these strings?

enter image description here

like image 473
jon Avatar asked Mar 08 '18 05:03

jon


People also ask

What is the use of syntax highlighting?

Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords like if or for in JavaScript differently than strings and comments and variable names.

Why template literals are not working in Vscode?

If you are using JavaScript's new template literal syntax in a JSP page it might not work as expected. That's because JSP and JavaScript both use the ${myVar} syntax.


2 Answers

OMG , after 3 hour research i find !!!!!

https://marketplace.visualstudio.com/items?itemName=Tobermory.es6-string-html

befor enter image description here

after enter image description here

enjoys

like image 59
jon Avatar answered Oct 23 '22 21:10

jon


The extension that you suggested requires that you prefix your strings with a comment like /*html*/ or html. I'm working with Angular, and I didn't want to go through all my templates to prefix them, so I found this extension that does it automatically without prefixes:

https://marketplace.visualstudio.com/items?itemName=natewallace.angular2-inline

It is included in the Angular Essentials package by John Papa:

https://marketplace.visualstudio.com/items?itemName=johnpapa.angular-essentials

like image 26
AsGoodAsItGets Avatar answered Oct 23 '22 21:10

AsGoodAsItGets