visitElementBefore method
Called when an Element has been reached, before its children have been visited.
Returns false
to skip its children.
Implementation
@override
bool visitElementBefore(md.Element element) {
_level++;
debugPrint('visitElementBefore $_level ${element.textContent}');
String lastTag = '';
if (_elementList.isNotEmpty) {
lastTag = _elementList.last.tag;
}
var textStyle = tagTextStyle(
lastTag,
element.tag,
_elementList.isNotEmpty ? _elementList.last.textStyle : defaultTextStyle,
);
_elementList.add(_Element(
element.tag,
textStyle,
element.attributes,
));
return true;
}