Skip to content

Commit

Permalink
Merge pull request #759 from mdboom/custom-exporters
Browse files Browse the repository at this point in the history
Add support for adding custom exporters to the "Download as" menu.
  • Loading branch information
takluyver authored Feb 12, 2018
2 parents 626c82a + 95ba694 commit 53f3c86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/source/external_exporters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ We are going to write an exporter that:
My custom exporter
"""
# If this custom exporter should add an entry to the
# "File -> Download as" menu in the notebook, give it a name here in the
# `export_from_notebook` class member
export_from_notebook = "My format"
def _file_extension_default(self):
"""
The new file extension is `.test_ext`
Expand Down
4 changes: 4 additions & 0 deletions nbconvert/exporters/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ class Exporter(LoggingConfigurable):
# the class, not just on instances.
output_mimetype = ''

# Should this converter be accessible from the notebook front-end?
# If so, should be a friendly name to display (and possibly translated).
export_from_notebook = None

#Configurability, allows the user to easily add filters and preprocessors.
preprocessors = List(
help="""List of preprocessors, by name or namespace, to enable."""
Expand Down

0 comments on commit 53f3c86

Please sign in to comment.