visitText method
Implementation
@override
String visitText(TextNode node) {
return node.content
.split('')
.map((ch) {
if (RegExp(r'^[0-9]+$').hasMatch(ch)) return "<mn>$ch</mn>";
if (RegExp(r'^\p{L}+$', unicode: true).hasMatch(ch)) {
return "<mi>${_escapeXml(ch)}</mi>";
}
if (['+', '-', '=', '<', '>', ',', '.', '!', ':', ';'].contains(ch)) {
return "<mo>${_escapeXml(ch)}</mo>";
}
if (ch == ' ') return "";
return "<mo>${_escapeXml(ch)}</mo>";
})
.join("");
}