How to fix "Error: HTMLHint not found, ..., CodeMirror HTML linting cannot run." error in CodeMirror
How to fix "Error: HTMLHint not found, ..., CodeMirror HTML linting cannot run." error in CodeMirror
我想让 HTML linting 为我的 CodeMirror 实例工作。我能够让 CSS 和 JS linting 正常工作,但 HTML linting 不工作。我仍然在 HTML 的控制台日志中收到“Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.
”错误。我在哪里包含全局“HTMLHint
”变量?
我已经下载了所需的 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>
我希望 linting 能够基于“<script></script>
”标签工作。显然我一定遗漏了什么。
在 HTML 提示 js 文件中说:
// 取决于 htmlhint.js from http://htmlhint.com/js/htmlhint.js
这是 github 中有效的 link。
https://raw.githubusercontent.com/htmlhint/brackets-htmlhint/master/htmlhint/htmlhint.js
只需将其包含在您的页面中即可。
我想让 HTML linting 为我的 CodeMirror 实例工作。我能够让 CSS 和 JS linting 正常工作,但 HTML linting 不工作。我仍然在 HTML 的控制台日志中收到“Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.
”错误。我在哪里包含全局“HTMLHint
”变量?
我已经下载了所需的 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>
我希望 linting 能够基于“<script></script>
”标签工作。显然我一定遗漏了什么。
在 HTML 提示 js 文件中说:
// 取决于 htmlhint.js from http://htmlhint.com/js/htmlhint.js
这是 github 中有效的 link。
https://raw.githubusercontent.com/htmlhint/brackets-htmlhint/master/htmlhint/htmlhint.js
只需将其包含在您的页面中即可。