/* libxmq - Copyright (C) 2026 Fredrik Öhrström (spdx: MIT) */ // Build a page with a doctype, elements and an attribute, and print it as compact xmq. import { DOMImplementation } from "@xmldom/xmldom"; import { print } from "libxmq"; const dom = new DOMImplementation(); const doc = dom.createDocument(null, "html", dom.createDocumentType("html", "", "")); const html = doc.documentElement!; const body = doc.createElement("body"); html.appendChild(body); const a = doc.createElement("a"); a.setAttribute("href", "https://libxmq.org"); body.appendChild(a); // The library prints xmq, the xml serializer of the DOM gives the markup. console.log(print(doc, { compact: true, escapeNewlines: true }));