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

Commit

Permalink
Fix #17
Browse files Browse the repository at this point in the history
- vertical align of checkbox

still some style problem, but ... anyway
  • Loading branch information
at15 committed Aug 4, 2015
1 parent e29ea65 commit ebd8657
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ var y = 3

- [ ] a
- [x] b
- I am just a simple list
- [x] checked
- [ ] not checked

## Contribute

Expand Down
10 changes: 6 additions & 4 deletions lib/renderer/toc-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ TocRenderer.prototype.heading = function (text, level) {
};

// TODO: move the to do list render to another file
TocRenderer.prototype.listitem = function(text) {
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>';
.replace(/^\s*\[ \]\s*/,
'<input type="checkbox" class="task-list-item-checkbox" disabled>')
.replace(/^\s*\[x\]\s*/,
'<input type="checkbox" class="task-list-item-checkbox" checked disabled>');
return '<li class="task-list-item">' + text + '</li>';
} else {
return '<li>' + text + '</li>';
}
Expand Down
6 changes: 6 additions & 0 deletions public/assets/style/bundle.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ ul {
width: 70%;
height: 100%;
overflow: auto; }
.markdown-content li.task-list-item {
list-style: none; }
.markdown-content li.task-list-item .task-list-item-checkbox {
margin: 0 0.35em 0.25em -1.6em;
vertical-align: middle;
cursor: default; }

.markdown-toc {
position: fixed;
Expand Down
12 changes: 12 additions & 0 deletions views/assets/style/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ ul{
height: 100%;

overflow: auto;

li.task-list-item {
list-style: none;

.task-list-item-checkbox {
// copied from github...
margin: 0 0.35em 0.25em -1.6em;
vertical-align: middle;
// otherwise the cursor would show a forbidden icon
cursor: default;
}
}
}

.markdown-toc{
Expand Down

0 comments on commit ebd8657

Please sign in to comment.