From 7ec71c9a10bd6f40eb0cb8fd2d6d4a1c76aa6b57 Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:26:44 +0100 Subject: [PATCH] fix: #1264 --- src/utils/convert.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/convert.ts b/src/utils/convert.ts index fd6db56..20ef160 100644 --- a/src/utils/convert.ts +++ b/src/utils/convert.ts @@ -428,11 +428,12 @@ async function rehype2remark(rehype: HRoot) { return mNode; } const children: any[] = []; + const paragraphNodes = ["list", "code", "math", "table"]; // Merge none-list nodes inside li into the previous paragraph node to avoid line break while (mNode.children.length > 0) { const current = mNode.children.shift(); const cached = children[children.length - 1]; - if (current?.type !== "list") { + if (current?.type && !paragraphNodes.includes(current?.type)) { if (cached?.type === "paragraph") { cached.children.push(current); } else {