简体   繁体   中英

How to fix "Error: HTMLHint not found, ..., CodeMirror HTML linting cannot run." error in CodeMirror

I want to get HTML linting working for my CodeMirror instance. I'm able to get CSS and JS linting working fine but HTML linting is not working. I'm still getting the " Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run. " error in the console log for HTML. Where do I include the global " HTMLHint " variable?

I have already downloaded the required HTML linting file ( // Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js ) and linked it in the " <head> ".

<head>
       <script src="plugin/HTMLHint-develop/dist/htmlhint.js"></script>
</head>

<script>
        var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
            theme: "rubyblue",
            mode: "htmlmixed",
            scrollbarStyle: "simple",
            indentUnit: 4,
            lineNumbers: true,
            lineWrapping: true,
            foldGutter: true,
            lint: true
        });
</script>

I would expect that the linting would work based on the " <script></script> " tag. Obviously I must be missing something.

Within the HTML Hint js file it says:

// Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js

Here is a working link in github.

https://raw.githubusercontent.com/htmlhint/brackets-htmlhint/master/htmlhint/htmlhint.js

Simply include it in your page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM