jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

Title in `_toc.yml` and page metadata does not over-ride page titles

Open orifox opened this issue 2 years ago • 6 comments

Describe the bug

When I type:

- file: notebooks/asdf_example/asdf_example.ipynb title: ASDF Example

The result pulls from the title of the notebook instead. Where the notebook is located: https://github.com/spacetelescope/jdat_notebooks/blob/main/notebooks/asdf_example/asdf_example.ipynb

I expect the sidebar to read: "ASD Example"

Picture attached. Entire repo here: https://github.com/spacetelescope/jdat_notebook

Screen Shot 2022-04-27 at 2 34 37 PM s

Reproduce the bug

The result pulls from the title of the notebook instead. Where the notebook is located: https://github.com/spacetelescope/jdat_notebooks/blob/main/notebooks/asdf_example/asdf_example.ipynb

List your environment

jupyter-book 0.12.3

orifox avatar Apr 27 '22 18:04 orifox

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar Apr 27 '22 18:04 welcome[bot]

thanks for reporting this @orifox

Just to clarify in your _config.yml do you have something like:

format: jb-book
root: index
chapters:
- file: path/to/chapter1
  title: <some title>

where title: is on its own line, but indented as part of the - file: group?

https://jupyterbook.org/en/stable/structure/configure.html#specify-alternate-titles

mmcky avatar Apr 29 '22 03:04 mmcky

Yes, correct. It didn't format correctly above. It looks like this:

format: jb-book
root: intro
parts:
  - caption: Cross-Instrument
    chapters:
    - file: notebooks/asdf_example/asdf_example.ipynb
      title: ASDF Example

orifox avatar May 02 '22 18:05 orifox

For the record, I'm able to reproduce this issue in a "real" jupyterbook, but not in a simple jupyterbook (gotten from creating jb create test.

I'll keep trying to debug it, I suspect I have to cleanup all of the notebook files to resolve all the errors that are similar to:

WARNING: Non-consecutive header level increase; 1 to 3 [myst.header]

I suspect those errors are causing this unintended effect.

Reminder: when debugging this, I've just remembered that it's worth it to wipe the _build directory and regenerate it: jb build .

firasm avatar Jul 20 '22 04:07 firasm

Update: the incorrect behaviour is gone once the Non-consecutive header level increase; warnings are dealt with. IMHO, those probably need to be errors instead of warnings, but I can see how that would be incredibly disruptive.

Perhaps a workaround could be to make the warning more specific: in addition to what's there, add "your table of content may behave in unexpected ways if these warnings are not resolved"

firasm avatar Jul 20 '22 17:07 firasm

Yep, confirmed. That's exactly the problem. Thanks.

orifox avatar Jul 20 '22 18:07 orifox