我想将jupyter notebook导出为html,并启用了代码折叠扩展名。
我试图关注the official docs
我在~/.jupyter/jupyter_nbconvert_config.py
# # not working, tried one line at a time
# Exporter.preprocessors += ['jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor']
# Exporter.preprocessors += ['jupyter_contrib_nbextensions.nbconvert_support.pre_codefolding']
# c.Exporter.preprocessors.append('jupyter_contrib_nbextensions.nbconvert_support.pre_codefolding')
# working for cmd line, eg:
# jupyter nbconvert --to html my_nb.ipynbc.Exporter.preprocessors.append('jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor')
c.Exporter.preprocessors += ['jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor']
c.CodeFoldingPreprocessor.remove_folded_code=True
以上都不适用于jupyter notebook File
- > Download as
- > HTML (.html)
但是,命令行中的jupyter nbconvert --to html my_nb.ipynb
确实有效。
问:如何在jupyter笔记本中完成这项工作?
仅供参考,我正在跑步: