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

Commit e29ea65

Browse files
committed
For #17 support to do list
- support [ ] - support [x] need to change the style and allow config class
1 parent 8e389a1 commit e29ea65

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

doc/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ var y = 3
2626
| ---- | ---- | ------- |
2727
| id | int | test |
2828

29+
#### I am check list
30+
31+
- [ ] a
32+
- [x] b
33+
2934
## Contribute
3035

3136
make a pr, and then ...

lib/renderer/toc-renderer.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,16 @@ TocRenderer.prototype.heading = function (text, level) {
1818
return '<h' + level + ' id="' + text + '">' + text + '</h' + level + '>';
1919
};
2020

21+
// TODO: move the to do list render to another file
22+
TocRenderer.prototype.listitem = function(text) {
23+
if (/^\s*\[[x ]\]\s*/.test(text)) {
24+
text = text
25+
.replace(/^\s*\[ \]\s*/, '<input type="checkbox" disabled>')
26+
.replace(/^\s*\[x\]\s*/, '<input type="checkbox" checked disabled>');
27+
return '<li class="check-list-item">' + text + '</li>';
28+
} else {
29+
return '<li>' + text + '</li>';
30+
}
31+
};
32+
2133
module.exports = TocRenderer;

0 commit comments

Comments
 (0)