mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 16:56:34 +01:00
7 lines
317 B
TypeScript
7 lines
317 B
TypeScript
export default function parseHTML(html: string, fragment = false) {
|
|
const template = document.createElement("template");
|
|
template.innerHTML = html;
|
|
const node = template.content.cloneNode(true);
|
|
if (fragment) return node;
|
|
return node.childNodes.length > 1 ? node.childNodes : node.childNodes[0];
|
|
} |