export function appendFragment(fragment: string, html: string) {
if (!fragment) return html;
let offset = Math.min(
html.lastIndexOf("</body>"),
html.lastIndexOf("</html>"),
);
if (offset === -1) offset = html.length;
return html.slice(0, offset) + fragment + html.slice(offset);
}