0.0.1 • Published 10 years ago

swig-marked v0.0.1

Weekly downloads
31
License
-
Repository
github
Last release
10 years ago

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 :(
    });