Skip to content

Commit

Permalink
Add source suffixes from nbsphinx_custom_formats unconditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Aug 28, 2022
1 parent 289ff73 commit fc79fd1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import collections.abc
import copy
import html
from itertools import chain
import json
import os
import re
Expand Down Expand Up @@ -1929,13 +1930,14 @@ def patched_toctree_resolve(self, docname, builder, toctree, *args, **kwargs):


def config_inited(app, config):
suffixes = [".ipynb", *config.nbsphinx_custom_formats]
for suffix in suffixes:
if (
suffix not in config.source_suffix
and suffix not in app.registry.source_suffix
):
app.add_source_suffix(suffix, 'jupyter_notebook')
for suffix in config.nbsphinx_custom_formats:
app.add_source_suffix(suffix, 'jupyter_notebook')
if '.ipynb' in chain(config.source_suffix, app.registry.source_suffix):
# We don't interfere if '.ipynb' has been added by the user in conf.py
# or by another Sphinx extension that has been loaded earlier.
pass
else:
app.add_source_suffix('.ipynb', 'jupyter_notebook')

if '**.ipynb_checkpoints' not in config.exclude_patterns:
config.exclude_patterns.append('**.ipynb_checkpoints')
Expand Down

0 comments on commit fc79fd1

Please sign in to comment.