diff --git a/src/runtime/markdown-parser/handler/list.ts b/src/runtime/markdown-parser/handler/list.ts index 22e680972..2221b3528 100644 --- a/src/runtime/markdown-parser/handler/list.ts +++ b/src/runtime/markdown-parser/handler/list.ts @@ -5,7 +5,9 @@ import { wrap } from './utils' type Node = MdastNode & { ordered?: boolean - start?: number + start?: number, + checked?: boolean + children: Node[] } export default function list (h: H, node: Node) { @@ -16,5 +18,10 @@ export default function list (h: H, node: Node) { props.start = node.start } + // Add class for task list. See: https://github.com/remarkjs/remark-gfm#use + if ((node.children || []).some(child => typeof child.checked === 'boolean')) { + props.className = ['contains-task-list'] + } + return h(node, name, props, wrap(all(h, node), true)) }