Can someone give me a step by step tutorial?

495 Views Asked by At

I started to use codeMirror... But i don't really understand the manual and don't find a good tutorial on the internet. At the moment, i managed to get this:

var codeHtml = $(".codemirror-html") [0];
var editor = CodeMirror.fromTextArea(codeHtml, {
    mode:  "htmlmixed",
    lineNumbers: true
});

It does basically works, there are linenumbers and a textarea :D, but the mode doesnt' works. It's just raw black text in the textarea. I think I importet the needed Files:

<script src="cm/lib/codemirror.js"></script>
<link rel="stylesheet" href="cm/lib/codemirror.css">
<script src="cm/mode/javascript/javascript.js"></script>
<script src="cm/mode/htmlmixed/htmlmixed.js"></script>

I don't know what I am doing wrong.. I alsow tried to add a theme, didn't worked as well. Please, can someone show me how to do it?

1

There are 1 best solutions below

0
On

The htmlmixed mode depends on the xml and css modes as well, so you'll have to add script tags for those.