markdown-it-condition
v0.1.4
Published
Plugin to create conditional block-level containers for markdown-it markdown parser
Downloads
4,711
Maintainers
Readme
markdown-it-condition
Plugin for creating if-else conditional blocks for markdown-it markdown parser.
With this plugin you can create conditional block like:
::if condition
*Show if condition is true*
::else
*Show if condition is false*
::endif
... and the selected content will be rendered as markdown markup.
<p><em>This text will be shown</em></p>
Derived from markdown-it-container.
Installation
node.js, browser:
$ npm install markdown-it-condition --save
$ bower install markdown-it-condition --save
API
var md = require('markdown-it')()
.use(require('markdown-it-condition'), name [, options]);
Example
var md = require('markdown-it')();
md.use(require('markdown-it-condition'));
console.log(md.render('::if flag.value\n*This text will be shown*\n::else\n*This text won\'t\n::endif'), {
flag: {
value: true
}
});
// Output:
//
// <p><em>This text will be shown</em></p>