render method
Renders a list of markdown nodes to ANSI-styled text.
Implementation
String render(List<Node> nodes) {
_buffer.clear();
_elementStack.clear();
_listDepth = 0;
_listCounters.clear();
_inBlockquote = false;
_blockquoteDepth = 0;
_lastWasBlock = false;
_pendingLinkUrl = null;
// Reset table state
_tableHeaders.clear();
_tableRows.clear();
_tableAlignments.clear();
_currentTableRow.clear();
_currentCellBuffer.clear();
_inTableHeader = false;
_inTableCell = false;
_inCodeBlock = false;
_codeBlockLanguage = null;
_inParagraph = false;
_paragraphBuffer.clear();
_textStyleActive = false;
for (final node in nodes) {
node.accept(this);
}
// Trim trailing whitespace but preserve structure
var result = _buffer.toString();
while (result.endsWith('\n\n')) {
result = result.substring(0, result.length - 1);
}
return result;
}