Defer cell metadata based manipulations to a transform
Currently, there are a number of places in the parser/renderer where we manipulate the docutils AST based on cell metadata
- https://github.com/ExecutableBookProject/MyST-NB/blob/ab4ba1d0964a7fe0a6cd516143ccc0a472b63570/myst_nb/parser.py#L56-L63
- https://github.com/ExecutableBookProject/MyST-NB/blob/ab4ba1d0964a7fe0a6cd516143ccc0a472b63570/myst_nb/parser.py#L207
- https://github.com/ExecutableBookProject/MyST-NB/blob/ab4ba1d0964a7fe0a6cd516143ccc0a472b63570/myst_nb/parser.py#L218
It would probably be better, for future development/extensibility, to handle these in a seperate transform, rather than 'hard-baking' them into the parser.
The full cell metadata should also be added to the CellNode, rather than just tags:
https://github.com/ExecutableBookProject/MyST-NB/blob/ab4ba1d0964a7fe0a6cd516143ccc0a472b63570/myst_nb/parser.py#L203-L205
That seems reasonable to me. That way all of the cell metadata is always present until the very end, and then at the last second a transform passes through all CellNodes and does what it needs to do based on what is inside?