Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write nbinteract converter for Gitbook #26

Closed
SamLau95 opened this issue Jan 14, 2018 · 1 comment
Closed

Write nbinteract converter for Gitbook #26

SamLau95 opened this issue Jan 14, 2018 · 1 comment
Assignees

Comments

@SamLau95
Copy link
Owner

SamLau95 commented Jan 14, 2018

I'd like to replace all the convert_notebooks_to_html_partial.py files we have across these textbooks:

With something like:

$ nbinteract --gitbook foo.ipynb bar.ipynb

# converts all notebooks in folder and outputs to notebooks-html/
$ nbinteract --gitbook --output notebooks-html notebooks/

# converts all notebooks in folder, outputs to notebooks-html/,
# and outputs images to notebooks-images/
$ nbinteract --gitbook --output notebooks-html --images notebook-images notebooks/

# converts all notebooks in folder and recurses into all subfolders
$ nbinteract --gitbook -r notebooks/

# converts all notebooks in folder and recurses into all subfolders,
# then outputs notebooks into notebooks-html without folders
$ nbinteract --gitbook --output notebooks-html -r notebooks/

Here's a docopt docstring that I think might work:

'''Converts notebooks to interactive HTML pages or Gitbook pages.

Usage:
  nbinteract NOTEBOOKS...

Arguments:
  NOTEBOOKS  The list of notebooks or folders containing notebooks to convert.

Options:
  -g --gitbook               Convert to HTML partial for Gitbook
  -r --recursive             Recursively convert notebooks in subdirectories.
                             Leaves HTML files in the same folders as the
                             original notebooks.
  -o FOLDER --output=FOLDER  Outputs HTML files into FOLDER. If -r is also set,
                             will not recreate input folder structure in output
                             folder (all output files are direct children of
                             FOLDER).
  -i FOLDER --images=FOLDER  Extracts images from HTML and writes into FOLDER.
                             Requires -o option to be set as well.
'''

Right now we have the following CLI option:

$ nbinteract my_notebook.ipynb

Which is a simple alias of

$ jupyter nbconvert --to interact my_notebook.ipynb

We'll have to change the script to use Python instead of bash.

@SamLau95
Copy link
Owner Author

Closed in #48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants