0

I've got a Jupyter notebook in percent format that I'd like to add the nbsphinx orphan property to. Is this possible?

So far, I've tried:

  1. Editing the metadata in the UI and saving (doesn't update the script)
  2. Saving it as a .ipynb, editing the metadata, and converting back with jupytext --to py:percent (doesn't keep the metadata)
  3. Manually adding a YAML header as described in the format link, as follows:
# ---
# nbsphinx:
#   orphan: true
# ---

None of these seemed to work, in that sphinx is still generating a "WARNING: document isn't included in any toctree".

Uri Granta
  • 1,814
  • 14
  • 25
  • That warning from Sphinx means that a document whose extension is configured in your `conf.py` to be processed by Sphinx is not listed in any `toctree` directive in any other file that Sphinx processes. See docs at https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-toctree – Steve Piercy Apr 24 '21 at 04:49
  • @StevePiercy Yes I know. The orphan directive is to disable that warning while still allowing the notebook to be linked to (without having it appear in a toc). – Uri Granta Apr 24 '21 at 06:05
  • If the notebook metadata gets lost in translation, you should create an issue at https://github.com/mwouts/jupytext. – Matthias Apr 29 '21 at 12:14

1 Answers1

0

I didn't try, but maybe this works:

# ---
# jupyter:
#   nbsphinx:
#     orphan: true
# ---
Matthias
  • 4,524
  • 2
  • 31
  • 50