Notes/packages/turndown-plugin-gfm/src/task-list-items.js

11 lines
322 B
JavaScript
Raw Normal View History

2017-11-10 14:21:46 +00:00
export default function taskListItems (turndownService) {
turndownService.addRule('taskListItems', {
filter: function (node) {
return node.type === 'checkbox' && node.parentNode.nodeName === 'LI'
},
replacement: function (content, node) {
return (node.checked ? '[x]' : '[ ]') + ' '
}
})
}