ignore markdown cells in `jupyter nbconvert` with `--to script`

后端 未结 3 2068
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-22 00:39

Is it possible to have jupyter nbconvert ... --to script ignore markdown cells rather than convert them to comments?

I\'m asking because I want to use

3条回答
  •  梦谈多话
    2021-01-22 01:17

    This seems to work:

    Create a template strip_markdown.tpl

    ## remove markdown cells
    {% extends 'python.tpl'%}
    {% block markdowncell -%}
    {% endblock markdowncell %}
    

    jupyter nbconvert my_notebook.ipynb --to python --template=strip_markdown.tpl

提交回复
热议问题