cleanTree static method
cleanTree optimizes the StyledElement tree so all BlockElement
s are
on the first level, redundant levels are collapsed, empty elements are
removed, and specialty elements are processed.
Implementation
static StyledElement cleanTree(StyledElement tree) {
tree = _processInternalWhitespace(tree);
tree = _processInlineWhitespace(tree);
tree = _removeEmptyElements(tree);
tree = _processListCharacters(tree);
tree = _processBeforesAndAfters(tree);
tree = _collapseMargins(tree);
tree = _processFontSize(tree);
return tree;
}