-
Notifications
You must be signed in to change notification settings - Fork 128
Description
Description
When using a file with children in the table of contents, the hierarchy is not respected.
The hierachy is however respected when using a title with children in the table of contents.
This is visible in the footer links for page back and forth. The footer links show the grandparent instead of the parent when the parent is a file instead of a title. In other words: the footer links show the title of the book in stead of the title of the part or chapter when the part or chapter is a file.
Oberserved bahaviour
When using this myst.yml:
version: 1
project:
toc:
- file: root.md
- title: Part A title
file: part-A.md
children:
- file: page-A-1.md
- file: page-A-2.md
- title: part B title
children:
- file: page-B-1.md
- file: page-B-2.md
site:
template: book-theme
Expected behaviour
Red ellipse on page A-1 should be "Part A" instead of "index"
Red rectangle on page B-1 should be "Part A" instead of "index"
Generally speaking:
In the rendered toc, a file with children is expected to behave exactly the same as a title with children, with one difference: when clicking on a file in the rendered toc, the item should not only expand but the rendered contents of the file should be shown.
Use case
I see two use cases for a file with children:
- Using a file with children is usefull to create a kind of landing page or short introduction paragraph for a part or a chapter.
- Using a file with children leads to a more intuitive respons of the rendered toc, as clicking on the chapter will not only expand it but is will also directly show the kind of landing-page instead of showing the last shown content-page.
Work around
No work around known: adding a title with a file or a file with a title in the toc doesn't provide a work-around.
Proposed solution
Implement expected behaviour as described above.
Additional notes
myst version 1.7.1 (and as far as I know all versions before)
basic example to demonstrate issue is here:
https://github.com/vangeest/mystmd-test/tree/demo-hierarchy
cc @bsipocz

