- let renderer = new markdown.Renderer();
- // Custom markdown checkbox list item
- // Attribution: https://github.com/chjj/marked/issues/107#issuecomment-44542001
- renderer.listitem = function(text) {
- if (/^\s*\[[x ]\]\s*/.test(text)) {
- text = text
- .replace(/^\s*\[ \]\s*/, '<input type="checkbox"/>')
- .replace(/^\s*\[x\]\s*/, '<input type="checkbox" checked/>');
- return `<li class="checkbox-item">${text}</li>`;
- }
- return `<li>${text}</li>`;
- };
+ const md = new MarkdownIt();
+ md.use(mdTasksLists, {label: true});