This adds two classes, a compiler which is designed to traverse each of the draft JS node types and the call the renderer for each type. The compiler is output format agnostic, the renderer does the work of transforming the node data.
For the special case of lists that need to have a wrapper I have wrapped them in a dummy AST node before sending off to the renderer. I did this using array chunking to pull out block nodes with list item types.
The renderer is required to have block, inline, list, wrapper and entity methods implemented for rendering each node type. List is for rendering the top level list of nodes.
This adds two classes, a compiler which is designed to traverse each of the draft JS node types and the call the renderer for each type. The compiler is output format agnostic, the renderer does the work of transforming the node data.
For the special case of lists that need to have a wrapper I have wrapped them in a dummy AST node before sending off to the renderer. I did this using array chunking to pull out block nodes with list item types.
The renderer is required to have block, inline, list, wrapper and entity methods implemented for rendering each node type. List is for rendering the top level list of nodes.