From 59cec751f7d590862520e72d4b0cfb3a0d31b08a Mon Sep 17 00:00:00 2001 From: Ahad Birang Date: Fri, 5 Aug 2022 17:50:01 +0430 Subject: [PATCH] fix(markdown): add missing task list class --- src/runtime/markdown-parser/handler/list.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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)) }