1.0.2 • Published 11 years ago
codemirror-highlight-node v1.0.2
codemirror-highlight-node
Transforms source code into formatted HTML using CodeMirror. Tabs, whitespaces and new line characters are preserved from original source code.
Install
npm install codemirror-highlight-nodeUsage
var highlight = require('codemirror-highlight-node');
highlight('function Test() {}', 'javascript');
// => <span class="cm-keyword">function</span> <span class="cm-variable">Test</span>() {}API
Loading this module will add two functions to CodeMirror:
- loadMode(name) - resolve and load requested mode
- highlightCode(code, modeSpec) - transform soruce code to formatted HTML
As modeSpec parameter you can use name (e.g. "javascript"), alias (e.g. "csharp" for C#) or full modeSpec object required by CodeMirror.
Module exports directly highlightCode function. CodeMirror object is also re-exported as highlightCode.CodeMirror.
LICENSE
MIT

