Skip to content

Commit

Permalink
fix(markdown): add missing task list class (#1416)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz authored Aug 5, 2022
1 parent cacee66 commit 91d257e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/runtime/markdown-parser/handler/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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))
}

0 comments on commit 91d257e

Please sign in to comment.