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 flake8
to check the Python code that's generated but I don't want to include the markdown cells (for example, because they are often long lines, and I don't want flake8 to complain about them).
This seems to work:
Create a template
strip_markdown.tpl
jupyter nbconvert my_notebook.ipynb --to python --template=strip_markdown.tpl
There is the command line argument
PythonExporter.exclude_markdown
that does what you want. To get a list of pep8 errors that just look at the code cells, I run