function escapeHtmlAttribute(value: string) { return value.replace(/&/g, "&").replace(/"/g, """).replace(//g, ">"); } export function serializeBodyAttributes(body: HTMLElement) { const attributes = ["dir", "lang", "style"] .map((name) => { const value = body.getAttribute(name); if (!value) { return null; } return `${name}="${escapeHtmlAttribute(value)}"`; }) .filter((value): value is string => Boolean(value)); return attributes.join(" "); } export function serializeStyleTag(value: string) { return ``; }