diff --git a/src/core/parser/markdown/compiler.ts b/src/core/parser/markdown/compiler.ts index 23102ca82..d30a7f03b 100644 --- a/src/core/parser/markdown/compiler.ts +++ b/src/core/parser/markdown/compiler.ts @@ -13,6 +13,23 @@ function parseAsJSON(node: Node, parent: DocusMarkdownNode[]) { if (node.type === 'element') { const childs = [] + if (node.tagName === 'prose-li') { + // unwrap unwanted paragraphs around `
  • ` children + node.children = (node.children as Node[]).flatMap(child => { + if (child.tagName === 'prose-paragraph') { + return [ + ...(child.children as Node[]), + { + type: 'element', + tagName: 'br', + properties: {} + } + ] + } + return child + }) + } + /** * Replace a tag with nuxt-link if relative */ diff --git a/src/core/parser/markdown/handler/listItem.ts b/src/core/parser/markdown/handler/listItem.ts index c92220f9c..b663c71d0 100644 --- a/src/core/parser/markdown/handler/listItem.ts +++ b/src/core/parser/markdown/handler/listItem.ts @@ -5,7 +5,6 @@ import all from 'mdast-util-to-hast/lib/all' export default function listItem(h: H, node: Node, parent: Node) { const result = all(h, node) - let head = result[0] const loose = parent ? listLoose(parent) : listItemLoose(node) const props: any = {} let wrapped = [] @@ -13,16 +12,7 @@ export default function listItem(h: H, node: Node, parent: Node) { let child if (typeof node.checked === 'boolean') { - if (!head || head.tagName !== 'p') { - head = h(null, 'p', []) - result.unshift(head) - } - - if (head.children.length > 0) { - head.children.unshift(u('text', ' ')) - } - - head.children.unshift( + result.unshift( h(null, 'input', { type: 'checkbox', checked: node.checked,