How to use HTML with JS/CSS inside Monaco editor

Viewed 270

I've been using Monaco Editor for over a year and it's amazing, simply amazing. However, the biggest problem I found so far is that if I load Monaco Editor (using language:'html') but if inside 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.

0 Answers
Related