Refactor Parsing Process
With the shiny new mistletoe-ebp
API (see https://mistletoe-ebp.readthedocs.io/en/latest/using/intro.html#programmatic-use), the parsing process has been refactored to be more inline with how it will occur for the text based representation:
- The full notebook is converted to an 'intermediate' mistletoe/markdown AST (before inline text is processed), in order to collect all link/footnote definitions
- This AST is then walked to 'expand'
SpanContainer
(see https://mistletoe-ebp.readthedocs.io/en/latest/using/intro.html#the-parse-process) - The
SphinxNBRenderer
is applyed once on the full AST (rather than for each cell as was done previously).
This involved creating a specific CodeCell
mistletoe token, then adding an extra render method to SphinxRenderer
that knows how to deal with it, basically using the code from https://github.com/ExecutableBookProject/MyST-NB/blob/d089de3c1140f72daf7c579be7637164ee548028/myst_nb/parser.py#L98
Note: this logic has been removed: https://github.com/ExecutableBookProject/MyST-NB/blob/d089de3c1140f72daf7c579be7637164ee548028/myst_nb/parser.py#L89
Since it is not compatible with the new process, as already discussed in #30