ace editor syntax validation html+javascript

2.1k views Asked by At

I'm using Ace Editor, and I'm trying to figure out how to get it to live syntax check the HTML markup AND JavaScript code in the editor.

If I set "ace/mode/html" only HTML syntax is checked, so in the following code

<!DOCTYPE HTML>
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <h1>Hello World!</h1>
        <script>
            alert('This is a syntax error'+);
        </script>
    </body>
</html>

the JS syntax error is ignored by the editor.

Is there a way to tell to Ace Editor to check both HTML and Javascript?

Thank you very much!

THIS IS NOT A DUPLICATE OF How do I enable Live Syntax Checking in the Ace Editor

The question above explains how to execute syntax check HTML and JS in 2 separate editors, while I'm asking how to check them in the same one.

1

There are 1 answers

3
a user On

You can use htmlhint, which has ace example running on thelanding page http://htmlhint.com/