visitText method
Called when a Text node has been reached.
Implementation
@override
void visitText(Text text) {
var content = text.textContent;
if (_tagfilterEnabled) {
content = _filterTags(content);
}
if (const ['br', 'p', 'li'].contains(_lastVisitedTag)) {
final lines = LineSplitter.split(content);
content = content.contains('<pre>')
? lines.join('\n')
: lines.map((line) => line.trimLeft()).join('\n');
if (text.textContent.endsWith('\n')) {
content = '$content\n';
}
}
buffer.write(content);
_lastVisitedTag = null;
}