Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the check list now working issue. #39

Closed
wants to merge 8 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/renderer.js
Expand Up @@ -16,6 +16,20 @@ function Renderer() {

require('util').inherits(Renderer, MarkedRenderer);

// Support To-Do List
Renderer.prototype.listitem = function(text) {
var result;

if (/^\s*(<p>\s*)?\[[x ]\]\s*/i.test(text)) {
text = text.replace(/^\s*(<p>\s*)?\[ \]\s*/i, '<input type="checkbox"></input> ').replace(/^\s*(<p>\s*)?\[x\]\s*/i, '<input type="checkbox" checked></input> ');
result = '<li style="list-style: none">' + text + '</li>\n';
} else {
result = '<li>' + text + '</li>\n';
}

return result;
};

// Add id attribute to headings
Renderer.prototype.heading = function(text, level) {
var transformOption = this.options.modifyAnchors;
Expand Down