nbsphinx
nbsphinx copied to clipboard
Use nbconvert's preprocessor framework
As noted in https://github.com/spatialaudio/nbsphinx/issues/341#issuecomment-544119639, nbsphinx directly uses the nbconvert execute preprocessor before the preprocessor queue is invoked. This changes the logic to use the nbconvert preprocessor queue. It also enables the user to give a configuration for preprocessors (for example, I used this to remove cells with certain tags).
The first commit in this PR appears to work just fine. However, with the second commit applied, building the ipywidgets docs with nbsphinx ends with some errors about files (notebooks) not found in the html-collect-pages step. Unfortunately, I ran out of time to debug this, but am opening a draft PR with my current in-progress work in hopes it will be of use.
This begins to address comments from https://github.com/spatialaudio/nbsphinx/issues/285, https://github.com/spatialaudio/nbsphinx/issues/305, https://github.com/spatialaudio/nbsphinx/issues/341.
Hello @jasongrout! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
- In the file
src/nbsphinx.py:
Line 877:13: E128 continuation line under-indented for visual indent Line 878:17: E128 continuation line under-indented for visual indent
Comment last updated at 2022-06-22 04:30:43 UTC
Thanks for this PR and sorry for my late response!
It would be great if we could provide a hook for users to provide additional preprocessor settings.
Sadly, I don't have time to look into this either, but maybe someone else does?
I was wondering if the RegexRemovePreprocessor should be forced, but I guess this isn't necessary anymore since https://github.com/jupyter/nbconvert/pull/784 has been merged.
However, I think we should force HighlightMagicsPreprocessor, because otherwise people might inadvertently disable the highlighting of "magic" cells.