【问题标题】:Hide all code when exporting notebook in Jupyter Lab to PDF将 Jupyter Lab 中的笔记本导出为 PDF 时隐藏所有代码
【发布时间】:2019-05-28 20:26:24
【问题描述】:

当我在 jupyter lab 中将笔记本导出为 PDF 时,我无法隐藏输出中的代码单元格。 (例如“查看 > 折叠所有代码”)

是否有在输出 PDF 中隐藏代码的内置功能? 例如使用单元格元数据?

【问题讨论】:

    标签: jupyter-notebook jupyter-lab


    【解决方案1】:

    这对我有用:

    jupyter nbconvert path/to/your/ipynb --to=pdf --TemplateExporter.exclude_input=True

    【讨论】:

    • 奇怪的是,在搜索排除输出的不同部分时,nbconvert 的文档并不是首先弹出的内容,但他们在此处的文档中讨论了这一点:nbconvert.readthedocs.io/en/latest/config_options.html
    • 我喜欢 @wspurgin 方法,因为它是 .py 文件中的一次性设置,然后所有导出都将按照您的意愿进行。您只需搜索“jupyter_nbconvert_config.py”并将c.TemplateExporter.exclude_input = True 添加到其中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-07
    • 2015-05-23
    • 1970-01-01
    相关资源
    最近更新 更多