如何在jupyter中使用codefolding导出?

时间:2017-11-25 08:46:16

标签: jupyter-notebook

我想将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笔记本中完成这项工作?

仅供参考,我正在跑步:

  • jupyter_client 5.1.0
  • jupyter_core 4.3.0
  • Python 3.6.2

0 个答案:

没有答案