Javascript CodeMirror不';显示HTML模式
我试图在我的web应用程序中使用CodeMirror模式,但它不会突出显示“htmlmixed”模式的单词。我不明白出了什么问题。每个文件的路径都是正确的,因为我没有收到任何404错误。以下是我所做的:Javascript CodeMirror不';显示HTML模式,javascript,jquery,html,css,codemirror,Javascript,Jquery,Html,Css,Codemirror,我试图在我的web应用程序中使用CodeMirror模式,但它不会突出显示“htmlmixed”模式的单词。我不明白出了什么问题。每个文件的路径都是正确的,因为我没有收到任何404错误。以下是我所做的: <!DOCTYPE html> <head> <script src="/node_modules/codemirror/lib/codemirror.js"></script> <link rel="s
<!DOCTYPE html>
<head>
<script src="/node_modules/codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="/path-to/codemirror/lib/codemirror.css">
<script src="/path-to/codemirror/lib/codemirror.js"></script>
<script src="/path-to/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<script src="/path-to/jquery.min.js"></script>
</head>
<html>
<textarea id="editor"></textarea>
....
</html>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
lineNumbers: true,
mode: "htmlmixed",
htmlMode: true,
});
</script>
....
var editor=CodeMirror.fromTextArea(document.getElementById(“编辑器”){
行号:对,
模式:“htmlmixed”,
htmlMode:是的,
});
任何帮助都将不胜感激
谢谢大家! HTML混合模式取决于
xml
、javascript
和css
模式。必须包含它们才能使htmlmixed
正常工作
以下是一个例子:
var editor=CodeMirror.fromTextArea(document.getElementById(“编辑器”){
行号:对,
模式:“htmlmixed”,
htmlMode:是的,
});代码>
p我是HTML/p
剧本
log(“我是JS”);
/剧本
这是一条实际路径吗?嗨,ksav,为了简单起见,我刚刚修改了路径。我实际代码中的路径是正确的。