toLegacyNode static method
Converts document into the current converter-compatible node tree.
Implementation
static TagflowNode toLegacyNode(TagflowDocument document) {
final legacyNode = switch (document.children.length) {
0 => TagflowElement.empty(),
1 => _legacyNodeFromDocumentNode(document.children.single),
_ => TagflowElement(
tag: 'div',
attributes: LinkedHashMap.from({'style': _syntheticRootStyle}),
children: document.children.map(_legacyNodeFromDocumentNode).toList(),
),
};
return legacyNode.reparent();
}