Tuesday, 16 March 2021

jupyter nbconvert: convert to markdown and/or html excluding slides marked as `skip`

Background

I have a notebook which I can export to reveal.js slides using:

jupyter nbconvert "${executed_nb_path}" \
    --to slides \
    --SlidesExporter.reveal_scroll=True \
    --TemplateExporter.exclude_input=True \
    --no-prompt

It excludes cells with cell metadata:

{
  "slideshow": {
    "slide_type": "skip"
  }
}

Question

How do I export to other outputs formats, such as html or md, and apply the same preprocessing with respect to cell metadata? I would like to be able to do this at the command line if possible (e.g. by setting command line arguments for the preprocessing), as opposed to creating a python script.

What I have tried

  1. Tried to work out the correct "traitlet" argument to add: docs here

    • no dice with --TagRemovePreprocessor.remove_cell_tags='slideshow.slide_type="skip"'
  2. Looked at the source code to see how the preprocessing is done:



from jupyter nbconvert: convert to markdown and/or html excluding slides marked as `skip`

No comments:

Post a Comment