我想让html linting为我的codemirror实例工作。我可以使CSS和JS覆盖效果正常,但是HTML绒布行不通。我仍在HTML的控制台日志中获得" Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.
"错误。我在哪里包括全局" HTMLHint
"变量?
我已经下载了所需的html linting文件(//取决于httmlhint.js的http://htmlhint.com/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>
我希望覆盖物将基于" <script></script>
"标签工作。显然我一定缺少一些东西。
在HTML提示JS文件中,它说:
//取决于htmlhint.js,来自http://htmlhint.com/js/htmlhint.js
这是github中的一个工作链接。
https://raw.githubusercontent.com/htmlhint/brackets-htmlhint/master/htmlhint/htmlhint/htmlhint.js
只需将其包含在您的页面中。