The markdown renderer currently relies on lineIndentWriter calculating
the indentation for a write by traversing the ancestors of a node.
This is fairly expensive and causes recomputation of prior information.
This changes lineIndentWriter to have PushIndent/PopIndent methods
which nodes call during traversal of the AST.
For example, blockquote can call
PushIndent("> ") when entering and PopIndent() when exiting,
to inform the writer of indentation of text within it.
The markdown renderer currently relies on lineIndentWriter calculating the indentation for a write by traversing the ancestors of a node. This is fairly expensive and causes recomputation of prior information.
This changes lineIndentWriter to have PushIndent/PopIndent methods which nodes call during traversal of the AST. For example, blockquote can call
PushIndent("> ")
when entering andPopIndent()
when exiting, to inform the writer of indentation of text within it.Results
List rendering is significantly faster now. There's a sub-microsecond increase on one of the cases, but it appears to be worth it.