markdown-it-todo-lists
v0.1.7
Published
A markdown-it plugin to create todo lists
Downloads
16
Maintainers
Readme
markdown-it-todo-lists
A markdown-it plugin to create todo lists.
- [ ] item 1
- [x] item 2
- [X] item 3
- [ ] item 1
- [x] item 2
- [X] item 3
Usage
npm i markdown-it-todo-lists
import MarkdownIt from 'markdown-it'
import MarkdownItTodoLists from 'markdown-it-todo-lists'
const md = MarkdownIt()
md.use(MarkdownItTodoLists, /* Options */)
const html = md.render(/* ... */)
For the options available, please refer to the jsdoc.
Functionality
- [ ] item 1
- [x] item 2
Use enabled = true
in options:
md.use(MarkdownItTodoLists, {
enabled: true
})
to HTML:
<ul class="todo-list-container">
<li class="todo-list-item">
<input class="todo-list-item-checkbox" type="checkbox" />item 1
</li>
<li class="todo-list-item">
<input class="todo-list-item-checkbox" type="checkbox" checked />item 2
</li>
</ul>
Use useLabel = true
in options:
md.use(MarkdownItTodoLists, {
useLabel: true
})
to HTML:
<ul class="todo-list-container">
<li class="todo-list-item">
<label>
<input class="todo-list-item-checkbox" type="checkbox" disabled />item 1
</label>
</li>
<li class="todo-list-item">
<label>
<input class="todo-list-item-checkbox" type="checkbox" checked disabled />item 2
</label>
</li>
</ul>