NOTE: This project is deprecated and is no longer mantained.
A library that highlights markdown (+ git flavored markdown). This library grammar/parser is heavily based on marked.
Note that this library is not yet another markdown to html
converter.
This library is meant to be used by markdown editors to provide syntax highlighting.
Highlights src
, adding markup that allows styling.
The result is HTML that contains span
tags wrapping known Markdown
blocks.
To style these tags, check the style.css
file for an example.
Available options:
- block: The block grammar to use, see
lib/grammar/block.js
. - inline: The inline grammar to use, see
lib/grammar/inline.js
require(['md-highlight'], function (highlighter) {
highlighter.highlight('# Title\n\nThis is an `example`.');
// This will output something like
// <span class="md-heading md-heading-1"># Title</span>\n\nThis is an <span class="md-icode">`example`</span>
});
Removes the highlight markup from the src
.
On the browser, this library is only available in the AMD format.
If you use RequireJS specify them like this:
// ...
paths : {
'md-highlight': '../bower_components/md-highlight/lib/highlighter'
}
// ...
Note that if you want to support IE8
or lower you will need to install es5-shim and require es5-shim
with your AMD loader before requiring this library.
Simply install it with npm install md-highlight
and use it as you would expect.
bower install
npm install
npm test
You will need bower to install the library dev dependencies.
Released under the MIT License.