visitText method
Called when a Text node has been reached.
Implementation
@override
void visitText(Text text) {
// Decode HTML entities (e.g., < > & " ')
var content = _htmlUnescape.convert(text.text);
// Apply blockquote prefix if inside a blockquote
if (_inBlockquote && content.contains('\n')) {
content = _applyBlockquotePrefix(content);
}
// Apply syntax highlighting for code blocks
if (_inCodeBlock) {
if (options.syntaxHighlighting && _codeBlockLanguage != null) {
// Apply syntax highlighting
content = _highlighter.highlightCode(
content,
language: _codeBlockLanguage,
);
}
// Apply code block border prefix for each line (after highlighting)
if (options.codeBlockBorder && content.contains('\n')) {
content = _applyCodeBlockPrefix(content);
}
}
// If inside a table cell, write to cell buffer instead
_activeBuffer.write(content);
}