CodeMirror Doesn't Display HTML Mode
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am trying to use CodeMirror modes in my web application, but it won't highlight the words for the mode "htmlmixed". I don't understand what is going wrong. The paths to each file are correct because I am not getting any 404 errors. Here is what I did:
<!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>
Any help would be greatly appreciated!
Thank you!
javascript jquery html css codemirror
add a comment |
I am trying to use CodeMirror modes in my web application, but it won't highlight the words for the mode "htmlmixed". I don't understand what is going wrong. The paths to each file are correct because I am not getting any 404 errors. Here is what I did:
<!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>
Any help would be greatly appreciated!
Thank you!
javascript jquery html css codemirror
<link rel="stylesheet" href="/path-to/codemirror/lib/codemirror.css">
Is this an actual path?
– ksav
Nov 23 '18 at 19:56
Hi ksav, I just revised the path for simplicity here. The path in my actual code is correct.
– CodeRocks
Nov 23 '18 at 19:59
add a comment |
I am trying to use CodeMirror modes in my web application, but it won't highlight the words for the mode "htmlmixed". I don't understand what is going wrong. The paths to each file are correct because I am not getting any 404 errors. Here is what I did:
<!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>
Any help would be greatly appreciated!
Thank you!
javascript jquery html css codemirror
I am trying to use CodeMirror modes in my web application, but it won't highlight the words for the mode "htmlmixed". I don't understand what is going wrong. The paths to each file are correct because I am not getting any 404 errors. Here is what I did:
<!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>
Any help would be greatly appreciated!
Thank you!
javascript jquery html css codemirror
javascript jquery html css codemirror
edited Nov 23 '18 at 20:22
CodeRocks
asked Nov 23 '18 at 19:39
CodeRocksCodeRocks
369
369
<link rel="stylesheet" href="/path-to/codemirror/lib/codemirror.css">
Is this an actual path?
– ksav
Nov 23 '18 at 19:56
Hi ksav, I just revised the path for simplicity here. The path in my actual code is correct.
– CodeRocks
Nov 23 '18 at 19:59
add a comment |
<link rel="stylesheet" href="/path-to/codemirror/lib/codemirror.css">
Is this an actual path?
– ksav
Nov 23 '18 at 19:56
Hi ksav, I just revised the path for simplicity here. The path in my actual code is correct.
– CodeRocks
Nov 23 '18 at 19:59
<link rel="stylesheet" href="/path-to/codemirror/lib/codemirror.css">
Is this an actual path?– ksav
Nov 23 '18 at 19:56
<link rel="stylesheet" href="/path-to/codemirror/lib/codemirror.css">
Is this an actual path?– ksav
Nov 23 '18 at 19:56
Hi ksav, I just revised the path for simplicity here. The path in my actual code is correct.
– CodeRocks
Nov 23 '18 at 19:59
Hi ksav, I just revised the path for simplicity here. The path in my actual code is correct.
– CodeRocks
Nov 23 '18 at 19:59
add a comment |
1 Answer
1
active
oldest
votes
The htmlmixed
mode depends on the xml
, javascript
, and css
modes. They must be included for htmlmixed
to work.
Here is an example:
var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
lineNumbers: true,
mode: "htmlmixed",
htmlMode: true,
});
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/htmlmixed/htmlmixed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/xml/xml.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/javascript/javascript.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/css/css.js"></script>
</head>
<html>
<textarea id="editor"><p> I am HTML</p>
<script>
console.log("I am JS");
</script></textarea>
</html>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452168%2fcodemirror-doesnt-display-html-mode%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The htmlmixed
mode depends on the xml
, javascript
, and css
modes. They must be included for htmlmixed
to work.
Here is an example:
var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
lineNumbers: true,
mode: "htmlmixed",
htmlMode: true,
});
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/htmlmixed/htmlmixed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/xml/xml.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/javascript/javascript.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/css/css.js"></script>
</head>
<html>
<textarea id="editor"><p> I am HTML</p>
<script>
console.log("I am JS");
</script></textarea>
</html>
add a comment |
The htmlmixed
mode depends on the xml
, javascript
, and css
modes. They must be included for htmlmixed
to work.
Here is an example:
var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
lineNumbers: true,
mode: "htmlmixed",
htmlMode: true,
});
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/htmlmixed/htmlmixed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/xml/xml.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/javascript/javascript.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/css/css.js"></script>
</head>
<html>
<textarea id="editor"><p> I am HTML</p>
<script>
console.log("I am JS");
</script></textarea>
</html>
add a comment |
The htmlmixed
mode depends on the xml
, javascript
, and css
modes. They must be included for htmlmixed
to work.
Here is an example:
var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
lineNumbers: true,
mode: "htmlmixed",
htmlMode: true,
});
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/htmlmixed/htmlmixed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/xml/xml.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/javascript/javascript.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/css/css.js"></script>
</head>
<html>
<textarea id="editor"><p> I am HTML</p>
<script>
console.log("I am JS");
</script></textarea>
</html>
The htmlmixed
mode depends on the xml
, javascript
, and css
modes. They must be included for htmlmixed
to work.
Here is an example:
var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
lineNumbers: true,
mode: "htmlmixed",
htmlMode: true,
});
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/htmlmixed/htmlmixed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/xml/xml.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/javascript/javascript.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/css/css.js"></script>
</head>
<html>
<textarea id="editor"><p> I am HTML</p>
<script>
console.log("I am JS");
</script></textarea>
</html>
var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
lineNumbers: true,
mode: "htmlmixed",
htmlMode: true,
});
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/htmlmixed/htmlmixed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/xml/xml.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/javascript/javascript.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/css/css.js"></script>
</head>
<html>
<textarea id="editor"><p> I am HTML</p>
<script>
console.log("I am JS");
</script></textarea>
</html>
var editor = CodeMirror.fromTextArea(document.getElementById("editor"), {
lineNumbers: true,
mode: "htmlmixed",
htmlMode: true,
});
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/codemirror.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/htmlmixed/htmlmixed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/xml/xml.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/javascript/javascript.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/mode/css/css.js"></script>
</head>
<html>
<textarea id="editor"><p> I am HTML</p>
<script>
console.log("I am JS");
</script></textarea>
</html>
answered Nov 23 '18 at 20:42
asemahleasemahle
9,53132933
9,53132933
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53452168%2fcodemirror-doesnt-display-html-mode%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
<link rel="stylesheet" href="/path-to/codemirror/lib/codemirror.css">
Is this an actual path?– ksav
Nov 23 '18 at 19:56
Hi ksav, I just revised the path for simplicity here. The path in my actual code is correct.
– CodeRocks
Nov 23 '18 at 19:59