Skip to content
Plugin to create checkboxes for markdown-it markdown parser.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist recompile dist from source Jul 24, 2015
test * switched back to coffee script Mar 23, 2015
.eslintignore refactored in order to pass lint. Mar 17, 2015
.gitignore refactored in order to pass lint. Mar 17, 2015
.npmignore initial commit Mar 16, 2015
.travis.yml
CHANGELOG.md releasing documentation fix Mar 17, 2015
LICENSE initial commit Mar 16, 2015
Makefile removed coffee script form tests. Mar 17, 2015
README.md
bower.json bumps package version Mar 23, 2015
coffeelint.json * switched back to coffee script Mar 23, 2015
gulpfile.coffee lowercasing gulpfile to fix ci problem. Mar 23, 2015
index.coffee
index.js * switched back to coffee script Mar 23, 2015
package.json changed test run for ci. Mar 23, 2015

README.md

markdown-it-checkbox NPM version

Build Status Coverage Status Dependency Status devDependency Status

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') // =>
// <p>
//  <input type="checkbox" id="checkbox0">
//  <label for="checkbox0">unchecked</label>
// </p>

md.render('[x] checked') // =>
// <p>
//  <input type="checkbox" id="checkbox0" checked="true">
//  <label for="checkbox0">checked</label>
// </p>

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') // =>
// <p>
//  <div classname="cb">
//    <input type="checkbox" id="cbx_0">
//    <label for="cbx_0">unchecked</label>
//  </div>
// </p>

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

You can’t perform that action at this time.