/** * Original source code from https://github.com/mcecot/markdown-it-checkbox * © 2015 Markus Cecot * licenced under MIT * https://github.com/mcecot/markdown-it-checkbox/blob/master/LICENSE */ var checkboxReplace; checkboxReplace = function(md, options, Token) { "use strict"; var arrayReplaceAt, createTokens, defaults, lastId, pattern, splitTextToken; arrayReplaceAt = md.utils.arrayReplaceAt; lastId = 0; defaults = { divWrap: false, divClass: 'checkbox', idPrefix: 'checkbox' }; options = Object.assign(defaults, options); pattern = /\[(X|\s|\_|\-)\]\s(.*)/i; createTokens = function(checked, label, Token) { var id, idNumeric, nodes, token; nodes = []; /** *
*/ if (options.divWrap) { token = new Token("checkbox_open", "div", 1); token.attrs = [["class", options.divClass]]; nodes.push(token); } /** * */ id = options.idPrefix + lastId; idNumeric = lastId; lastId += 1; token = new Token("checkbox_input", "input", 0); token.attrs = [["type", "checkbox"], ["id", id], ["data-id", idNumeric]]; if (checked === true) { token.attrs.push(["checked", "true"]); } nodes.push(token); /** *