Skip to content

Commit

Permalink
Update list renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
yahtnif committed Mar 15, 2019
1 parent 4f6b387 commit 89c02d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions __tests__/base/task_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- [ ] todo
- [x] done



<ul class="task-list">
<li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled> todo</li>
<li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" checked disabled> done</li>
</ul>
9 changes: 6 additions & 3 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ ${quote}</blockquote>
isTaskList?: boolean
): string {
const type: string = ordered ? 'ol' : 'ul'
const startatt: string =
let startatt: string =
ordered && start !== 1 ? ' start="' + start + '"' : ''
if (isTaskList) {
startatt += ' class="task-list"'
}

return `<${type}${startatt}>\n${body}</${type}>\n`
}
Expand All @@ -110,8 +113,8 @@ ${quote}</blockquote>
return checked === null
? `<li>${text}</li>
`
: `<li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" ${
checked ? 'checked ' : ''
: `<li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox"${
checked ? ' checked' : ''
} disabled> ${text}</li>
`
}
Expand Down

0 comments on commit 89c02d1

Please sign in to comment.