Skip to content

Instantly share code, notes, and snippets.

@zthxxx
Created August 28, 2019 02:54
Show Gist options
  • Save zthxxx/ce5d9041ffdd069c4ac1f0d3c74c8a85 to your computer and use it in GitHub Desktop.
Save zthxxx/ce5d9041ffdd069c4ac1f0d3c74c8a85 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