ipython-contrib / jupyter_contrib_nbextensions

A collection of various notebook extensions for Jupyter
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest
Other
5.22k stars 806 forks source link

[toc2] Make `nbconvert --to html_toc` aware of changes to default toc2 options #1480

Open joelostblom opened 4 years ago

joelostblom commented 4 years ago

Changes I make to the default toc2 options via the Nbextension menu on the Jupyter Notebooks launcher page, seem to not propagate to the export options when using jupyter nbconvert --to html_toc. As I understand it, this is because the default options only indicate which toc metadata should be written to notebooks as they are opened for the first time, but if the notebook is not opened, there is no way for nbconvert to know of these default options since it only reads the metadata from the notebook it is exporting, not anything from the default toc2 options. Is this correctly understood?

I am mainly using JupyterLab, so this is why I am interested in nbconvert knowing about the toc2 options when exporting without actually having opened the .ipynb file in the classic notebook interface.

Fow now, I am adding the metadata manually, something like

    "toc": {
        "number_sections": false,
        "sideBar": true
    }

via the JupyterLab side panel tab for notebook metadata. This is not at all a lot of work since I only need to do it once per notebook, but I am curious if I am missing an easier and more robust solution. For example, I recently found out about the flag --ExtractOutputPreprocessor.enabled=False, which is great! Are any toc metadata properties exposed in a similar manner?

Mentioning @jfbercher since this is a repo of many different addons and you seem to answer many toc2 related question. Let me know if this is incorrect and I can remove the mention.