Search code examples
firebasefirepad

Rendering code in Firepad using CodeMirror


I'm using FirePad to create an IDE of sorts for myself. What I'm trying to do is use the userlist.html in examples/ to render JS code. This is done in examples/code.html, and I've changed:

var codeMirror = CodeMirror(document.getElementById('firepad'), { lineWrapping: true });

to

var codeMirror = CodeMirror(document.getElementById('firepad'), {
  lineNumbers: true,
  mode: 'javascript'
});

It does display the line numbers, but it does not highlight the JS.

To clarify, I'm making these changes in examples/userlist.html


Solution

  • You'll need to include the javascript mode file as well:

    <script src="codemirror/mode/javascript/javascript.js"></script>