Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nbconvert's preprocessor framework #650

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jasongrout
Copy link

As noted in #341 (comment), 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 #285, #305, #341.

@pep8speaks
Copy link

pep8speaks commented Jun 22, 2022

Hello @jasongrout! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

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

This enables users to give nbconvert configuration, such as preprocessor settings, as part of their sphinx config.
This allows the cell removal plugins to remove cells before execution, for example.

There is a problem using this nbsphinx with ipywidets - it complains about missing files in the html-collect-pages step.
jasongrout added a commit to jasongrout/ipywidgets that referenced this pull request Jun 22, 2022
This uses the first commit of spatialaudio/nbsphinx#650, f963a2a3b7f31a844b31a3fca0fe653f37b500a2, in order to pass nbconvert options to nbsphinx.
@mgeier
Copy link
Member

mgeier commented Jul 15, 2022

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 jupyter/nbconvert#784 has been merged.

However, I think we should force HighlightMagicsPreprocessor, because otherwise people might inadvertently disable the highlighting of "magic" cells.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants