markdown-it-checkbox
Plugin to create checkboxes for markdown-it markdown parser.
This plugin allows to create checkboxes for tasklists as discussed here.
Usage
Install
node.js, browser:
npm install markdown-it-checkbox --save
bower install markdown-it-checkbox --save
Use
var md = require('markdown-it')()
.use(require('markdown-it-checkbox'));
md.render('[ ] unchecked')
md.render('[x] checked')
Differences in browser. If you load script directly into the page, without
package system, module will add itself globally as window.markdownitCheckbox
.
Options
var md = require('markdown-it')()
.use(require('markdown-it-checkbox'),{
divWrap: true,
divClass: 'cb',
idPrefix: 'cbx_'
});
md.render('[ ] unchecked')
divWrap
- Type:
Boolean
- Default:
false
wrap div arround checkbox. this makes it possible to use it for example with Awesome Bootstrap Checkbox.
divClass
- Type:
String
- Default:
checkbox
classname of div wrapper. will only be used if divWrap
is enanbled.
idPrefix
- Type:
String
- Default:
checkbox
the id of the checkboxs input contains the prefix and an incremental number starting with 0
. i.e. checkbox1
for the 2nd checkbox.
License
MIT License © 2015 Markus Cecot