monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

Language set as HTML not formating correctly when contains CSS/JS

Open batata004 opened this issue 4 years ago • 5 comments

When I load Monaco Editor (using language:'html') but if in the contents I have <style> or <script> tags, it will not format the contents of those tags, only the HTML tags like <body>, <div>...

For example:

<div>XXX</div>
<div><b>AAA</b> ccc <span>ddd</span></div>

<style type="text/css">
body{
   padding:10px;
}
</style>

If you load this code in Monaco Editor you will see it will nicely format <div> and <b> and <span> but the contents of <style> will not be format as CSS, it will all be unformatted and with the same color.

batata004 avatar Sep 17 '21 21:09 batata004

This is possible in VSCode, but not in monaco editor, and I am also looking for a solution.

yunbookf avatar Oct 30 '21 16:10 yunbookf

@yunbookf thank you! If you find a solution I would be glad if you could share it with me. I appreciate any help you can provide to solve this problem!

batata004 avatar Oct 30 '21 21:10 batata004

Any updates? I'm also searching for a solution.

zojize avatar Mar 22 '22 08:03 zojize

I have the same need

shihao316558512 avatar Mar 28 '22 09:03 shihao316558512

me too

bosens-China avatar Sep 06 '24 06:09 bosens-China