diff --git a/src/markdown/rehype-audio.ts b/src/markdown/rehype-audio.ts index 2f40c9c3..6d900b2a 100644 --- a/src/markdown/rehype-audio.ts +++ b/src/markdown/rehype-audio.ts @@ -29,8 +29,9 @@ export const rehypeAudio: Plugin, Root> = ({ first = false } - if (parent) { - parent.children[i!] = { + if (parent && parent.type === "element" && i !== null) { + parent.tagName = "div" + parent.children[i] = { type: "element", tagName: "audio", properties: {