fix(code): bypass if no `<code />` wrapper

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei 2024-10-14 13:12:15 +08:00
parent 3f06c717a2
commit f84c12e099
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
1 changed files with 3 additions and 2 deletions

View File

@ -177,11 +177,12 @@ export const parseHtml = (
codeString = props.children.toString()
} else {
const propsChildren = props.children
let children = Array.isArray(propsChildren)
const children = Array.isArray(propsChildren)
? propsChildren.find((i) => i.type === "code")
: propsChildren
if (!children) children = createElement("pre", props, props.children)
// Don't process not code block
if (!children) return createElement("pre", props, props.children)
if (
"type" in children &&