makeIndentedTree = root => {
const output = html`<div>`;
const indentChildren = function(node, parentEl) {
if (!node.children) return;
const ul = html`<ul class="doc-tree-list">`;
parentEl.appendChild(ul);
node.children.forEach(child => {
if (child.data && child.data.el) {
const cloned = child.data.el.cloneNode(true);
const li = html`<li class="doc-tree-list-item">${cloned}</li>`;
ul.appendChild(li);
}
indentChildren(child, ul);
});
};
indentChildren(root, output);
return output;
}