The current system where each node renders itself using the Renderable trait isn't very extensible. In an ideal world, you'd have a generic Visitor trait which lets you walk the entire document tree, using default impls to make your life easier.
The Renderable trait now just turns into some Printer object which will visit each node, printing them to a Writer. This allows you to do more complex things like a preprocessing pass to ensure you pull in all the packages you need (e.g. walk the tree then if you see a Table node you'll make sure to include booktabs in the preamble) and other manipulations before printing to the final document.
The current system where each node renders itself using the
Renderable
trait isn't very extensible. In an ideal world, you'd have a genericVisitor
trait which lets you walk the entire document tree, using default impls to make your life easier.The
Renderable
trait now just turns into somePrinter
object which will visit each node, printing them to aWriter
. This allows you to do more complex things like a preprocessing pass to ensure you pull in all the packages you need (e.g. walk the tree then if you see aTable
node you'll make sure to includebooktabs
in the preamble) and other manipulations before printing to the final document.