/swig-marked

Markdown filter and tag based on marked

Primary LanguageJavaScriptGNU General Public License v2.0GPL-2.0

swig-marked

Markdown filter and tag based on marked. As the name already states, this module combines swig and marked.

There is already a markdown filter/tag in the package swig-extras, however, that one uses markdown, and I wanted to have marked for it's support for tables and GFM.

usage:

    var markedSwig = require('swig-marked'),
        swig = require('swig');


    markedSwig.useFilter( swig );
    markedSwig.useTag( swig );

    swig.render( '{% marked %}# hello world{% endmarked %}' );

    // <h1 id="hello-word">hello world</h1>


    swig.render('{{ words|marked }}', { locals: { words: '# hello word' } });

    // <h1 id="hello-world">hello world</h1>

    // filter and tag are also exposed like so:
    swig.setFilter( 'dingus', markedSwig.filter);
    swig.render('{{ words|dingus }}', { locals: { words: '# hello word' } });

    // <h1 id="hello-world">hello world</h1>

    // provide configuration options to marked:
    var configured = markedSwig.configure({
        gfm: false, // no more gfm :(
    });

attribution

A large part of this code is based upon upon the original markdown tag writen by Paul Armstrong, and extended from the marked tag written by Jon Schlinkert, Brian Woodward & contributors.