codemirror-highlight
Generating HTML containing highlighted code with CodeMirror
Installation
npm install codemirror-highlight
Example
var assert = ;var CodeMirror = ; CodeMirror;var html = CodeMirror; assert;
API
CodeMirror.loadMode(mode)
mode
- a string containing the mode name
Load mode
shipped with CodeMirror. A list of modes can be found here.
CodeMirror.highlight(code, options)
code
- a string of code to be highlightedoptions
- an object literal supporting these options:mode
- the same as the modeoption
you should pass to vanilla CodeMirrortabSize
- the width of a tab character. Defaults to 4.
Return the HTML containing highlighted code