Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
For #17 support to do list
Browse files Browse the repository at this point in the history
- support [ ]
- support [x]

need to change the style and allow config class
  • Loading branch information
at15 committed Aug 4, 2015
1 parent 8e389a1 commit e29ea65
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ var y = 3
| ---- | ---- | ------- |
| id | int | test |

#### I am check list

- [ ] a
- [x] b

## Contribute

make a pr, and then ...
12 changes: 12 additions & 0 deletions lib/renderer/toc-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,16 @@ TocRenderer.prototype.heading = function (text, level) {
return '<h' + level + ' id="' + text + '">' + text + '</h' + level + '>';
};

// TODO: move the to do list render to another file
TocRenderer.prototype.listitem = function(text) {
if (/^\s*\[[x ]\]\s*/.test(text)) {
text = text
.replace(/^\s*\[ \]\s*/, '<input type="checkbox" disabled>')
.replace(/^\s*\[x\]\s*/, '<input type="checkbox" checked disabled>');
return '<li class="check-list-item">' + text + '</li>';
} else {
return '<li>' + text + '</li>';
}
};

module.exports = TocRenderer;

0 comments on commit e29ea65

Please sign in to comment.