Skip to content

Commit

Permalink
Use add_source_suffix() if available
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Jul 24, 2018
1 parent 3f43216 commit 80cb5fb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ class NotebookParser(rst.Parser):
"""

supported = ()
supported = 'jupyter_notebook',

def get_transforms(self):
"""List of transforms for documents parsed by this parser."""
Expand Down Expand Up @@ -1448,7 +1448,12 @@ def _add_notebook_parser(app):

def setup(app):
"""Initialize Sphinx extension."""
_add_notebook_parser(app)
try:
# Available since Sphinx 1.8:
app.add_source_suffix('.ipynb', 'jupyter_notebook')
app.add_source_parser(NotebookParser)
except AttributeError:
_add_notebook_parser(app)

app.add_config_value('nbsphinx_execute', 'auto', rebuild='env')
app.add_config_value('nbsphinx_kernel_name', '', rebuild='env')
Expand Down

0 comments on commit 80cb5fb

Please sign in to comment.