Skip to content

Instantly share code, notes, and snippets.

@sccolbert
Created September 16, 2015 01:28
Show Gist options
  • Save sccolbert/82f6f4e629768dea1ef1 to your computer and use it in GitHub Desktop.
Save sccolbert/82f6f4e629768dea1ef1 to your computer and use it in GitHub Desktop.
[traitletsargs] C:\Users\Chris\Development>python -m jupyter_core.command nbcon
ert "0 - name.ipynb" --to slides --post serve
[traitletsargs] C:\Users\Chris\Development>This application is used to convert
otebook files (*.ipynb) to various other
formats.
WARNING: THE COMMANDLINE INTERFACE MAY CHANGE IN FUTURE RELEASES.
Options
-------
Arguments that take values are actually convenience aliases to full
Configurables, whose aliases are listed on the help line. For more information
on full configurables, see '--help-all'.
-y
Answer yes to any questions instead of prompting.
--execute
Execute the notebook prior to export.
--allow-errors
Continue notebook execution even if one of the cells throws an error and in
lude the error message in the cell output (the default behaviour is to abort co
version). This flag is only relevant if '--execute' was specified, too.
--stdout
Write notebook output to stdout instead of files.
--debug
set log level to logging.DEBUG (maximize logging output)
--inplace
Run nbconvert in place, overwriting the existing notebook (only
relevant when converting to notebook format)
--generate-config
generate default config file
--reveal-prefix=<Unicode> (RevealHelpPreprocessor.url_prefix)
Default: 'reveal.js'
The URL prefix for reveal.js. This can be a a relative URL for a local copy
of reveal.js, or point to a CDN.
For speaker notes to work, a local reveal.js prefix must be used.
--nbformat=<Enum> (NotebookExporter.nbformat_version)
Default: 4
Choices: [1, 2, 3, 4]
The nbformat version to write. Use this to downgrade notebooks.
--writer=<DottedObjectName> (NbConvertApp.writer_class)
Default: 'FilesWriter'
Writer class used to write the results of the conversion
--log-level=<Enum> (Application.log_level)
Default: 30
Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICA
')
Set the log level by value or name.
--to=<CaselessStrEnum> (NbConvertApp.export_format)
Default: 'html'
Choices: ['custom', 'html', 'latex', 'markdown', 'notebook', 'pdf', 'python
, 'rst', 'script', 'slides']
The export format to be used.
--template=<Unicode> (TemplateExporter.template_file)
Default: u''
Name of the template file to use
--output=<Unicode> (NbConvertApp.output_base)
Default: ''
overwrite base name use for output files. can only be used when converting
one notebook at a time.
--post=<DottedOrNone> (NbConvertApp.postprocessor_class)
Default: u''
PostProcessor class used to write the results of the conversion
--config=<Unicode> (JupyterApp.config_file)
Default: u''
Full path of a config file.
To see all available configurables, use `--help-all`
Examples
--------
The simplest way to use nbconvert is
> jupyter nbconvert mynotebook.ipynb
which will convert mynotebook.ipynb to the default format (probably HTML).
You can specify the export format with `--to`.
Options include ['custom', 'html', 'latex', 'markdown', 'notebook', 'pdf',
python', 'rst', 'script', 'slides']
> jupyter nbconvert --to latex mynotebook.ipynb
Both HTML and LaTeX support multiple output templates. LaTeX includes
'base', 'article' and 'report'. HTML includes 'basic' and 'full'. You
can specify the flavor of the format used.
> jupyter nbconvert --to html --template basic mynotebook.ipynb
You can also pipe the output to stdout, rather than a file
> jupyter nbconvert mynotebook.ipynb --stdout
PDF is generated via latex
> jupyter nbconvert mynotebook.ipynb --to pdf
You can get (and serve) a Reveal.js-powered slideshow
> jupyter nbconvert myslides.ipynb --to slides --post serve
Multiple notebooks can be given at the command line in a couple of
different ways:
> jupyter nbconvert notebook*.ipynb
> jupyter nbconvert notebook1.ipynb notebook2.ipynb
or you can specify the notebooks list in a config file, containing::
c.NbConvertApp.notebooks = ["my_notebook.ipynb"]
> jupyter nbconvert --config mycfg.py
[NbConvertApp] CRITICAL | Bad config encountered during initialization:
[NbConvertApp] CRITICAL | Invalid argument: '-'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment