(parsed: ParsedDocument)
| 14 | * If the original input had a full HTML shell (wrapped=false), returns the full document. |
| 15 | */ |
| 16 | export function serializeDocument(parsed: ParsedDocument): string { |
| 17 | const doc = parsed.document; |
| 18 | if (parsed.wrapped) { |
| 19 | return (doc.body as HTMLBodyElement).innerHTML ?? ""; |
| 20 | } |
| 21 | return `<!DOCTYPE html>\n${doc.documentElement.outerHTML}`; |
| 22 | } |
no outgoing calls