Notes/packages/turndown-plugin-gfm/src/task-list-items.js
Elian Doran d3423127d8 Add 'packages/turndown-plugin-gfm/' from commit '0f43299c17108e9508e7e6237369e86f504ea60a'
git-subtree-dir: packages/turndown-plugin-gfm
git-subtree-mainline: ebebdd0b07edda953fdc71b0003c223a6531e05c
git-subtree-split: 0f43299c17108e9508e7e6237369e86f504ea60a
2025-03-19 18:16:20 +02:00

11 lines
322 B
JavaScript

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]' : '[ ]') + ' '
}
})
}