Skip to content

Instantly share code, notes, and snippets.

@voicon
Forked from zthxxx/nbconvert-render.sh
Created February 8, 2021 08:55
Show Gist options
  • Save voicon/7648f2bb23b59d11c871124bf8e48fce to your computer and use it in GitHub Desktop.
Save voicon/7648f2bb23b59d11c871124bf8e48fce to your computer and use it in GitHub Desktop.
nbconvert code snippet
# https://nbconvert.readthedocs.io/en/latest/usage.html
# notebook: notebook 文件绝对地址,结尾扩展名 .ipynb
# target_name: 输出目标文件名,无后缀名,根据 type 自动对应生成
# format: 渲染格式 - asciidoc, custom, html, latex, markdown, notebook, pdf, python, rst, script, slides
# render_dir: 输出目录绝对路径
python -m nbconvert -y \
--ExecutePreprocessor.kernel_name="${jupyter_kernel}" \
--ExecutePreprocessor.timeout=-1 \
--execute "${notebook}" \
--output-dir "${render_dir}" \
--to "${format}" \
--output "${target_name}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment