[英]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.