简体   繁体   English

如何修复“错误:未找到 HTMLHint,...,CodeMirror HTML linting 无法运行。” 代码镜像中的错误

[英]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.我想让 HTML linting 为我的 CodeMirror 实例工作。 I'm able to get CSS and JS linting working fine but HTML linting is not working.我能够让 CSS 和 JS linting 正常工作,但 HTML linting 不起作用。 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.我仍然收到“ Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run. ”HTML 控制台日志中的错误。 Where do I include the global " HTMLHint " variable?我在哪里包含全局“ HTMLHint ”变量?

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> ".我已经下载了所需的 HTML linting 文件( // 取决于http://htmlhint.com/js/htmlhint.js 中的htmlhint.js )并将其链接到“ <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.我希望 linting 会基于“ <script></script> ”标签工作。 Obviously I must be missing something.显然我一定错过了一些东西。

Within the HTML Hint js file it says:在 HTML 提示 js 文件中,它说:

// Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js // 依赖于http://htmlhint.com/js/htmlhint.js 中的htmlhint.js

Here is a working link in github.这是github中的一个工作链接。

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

Simply include it in your page.只需将其包含在您的页面中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用于代码镜像的HTMLHint验证程序 - HTMLHint Validator for Codemirror 错误:无法读取未定义的属性“缩进”(CodeMirror) - ERROR: Cannot read property 'indent' of undefined (CodeMirror) 如何解决CodeMirror中的输入问题 - How to fix input issue in CodeMirror Codemirror-linting - 是否有事件明确触发linting? - Codemirror- linting - Is there a event to trigger linting explictly? 解决WordPress中的CodeMirror库冲突错误“Uncaught TypeError: CodeMirror is not a function” - Solving CodeMirror library conflict error "Uncaught TypeError: CodeMirror is not a function" in WordPress Javascript 使用 CodeMirror.js 错误:未捕获的 ReferenceError:未定义 CodeMirror - Javascript using CodeMirror.js Error: Uncaught ReferenceError: CodeMirror is not defined 无法读取未定义错误的属性“ setValue”。 如何使用Selenium WebDriver和Java在codeMirror元素中键入文本? - Cannot read property 'setValue' of undefined error. How to type text in codeMirror element using Selenium WebDriver and Java? 使用CodeMirror时如何解决AutoComplete错误? - How do I resolve an AutoComplete error when using CodeMirror? React-codemirror 2 linting 功能不起作用 - React-codemirror 2 linting feature not working Codemirror fromTextArea错误:options.value未定义 - Codemirror fromTextArea error: options.value is undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM