Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions nbconvert/exporters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ def export(exporter, nb, **kw):
return output, resources


def get_exporter(name, config=get_config()): # noqa: B008
def get_exporter(name, config=None):
"""Given an exporter name or import path, return a class ready to be instantiated

Raises ExporterName if exporter is not found or ExporterDisabledError if not enabled
"""

if config is None:
config = get_config()

if name == "ipynb":
name = "notebook"

Expand Down Expand Up @@ -126,19 +129,23 @@ def get_exporter(name, config=get_config()): # noqa: B008
raise ExporterNameError(msg)


def get_export_names(config=get_config()): # noqa: B008
def get_export_names(config=None):
"""Return a list of the currently supported export targets

Exporters can be found in external packages by registering
them as an nbconvert.exporter entrypoint.
"""

exporters = sorted(e.name for e in entry_points(group="nbconvert.exporters"))
if os.environ.get("NBCONVERT_DISABLE_CONFIG_EXPORTERS"):
get_logger().info(
"Config exporter loading disabled, no additional exporters will be automatically included."
)
return exporters

if config is None:
config = get_config()

enabled_exporters = []
for exporter_name in exporters:
try:
Expand Down
Loading