javascript and css language support in html...

Hi Everyone,

I noticed that javascript().support and css().support are included in the html language extension.

from lang-html/index.js:

function html(config = {}) {
let lang = htmlLanguage;
if (config.matchClosingTags === false)
lang = lang.configure({ dialect: “noMatch” });
return new LanguageSupport(lang, [
htmlLanguage.data.of({ autocomplete: htmlCompletionSource }),
config.autoCloseTags !== false ? autoCloseTags : [],
javascript().support,
css().support
]);
}

But, they don’t seem to be applied when I set the html extension:

html({autoCloseTags: true, matchClosingTags: false})

html support works (syntax highlighting and code completion, etc.) but javascript and css render as plain text. Is there anything else I need to do to switch these on?

And can I combine support for html, javascript and css in the same document?

The HTML mode will highlight the content of <style> and <script> tags as CSS and JavaScript. Is that not working for you?

@marijn Ah, thank you, indeed, that works :slight_smile: I hadn’t realised that the css and js code needed to be inside their relevant <style> and <script> tags, but of course that make perfect sense.