Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOC that mixes drop-downs with individual files? #9

Open
rgiordan opened this issue Nov 27, 2023 · 2 comments
Open

TOC that mixes drop-downs with individual files? #9

rgiordan opened this issue Nov 27, 2023 · 2 comments

Comments

@rgiordan
Copy link

Is there a way in Myst to mix "parts" and files in the table of contents? For example, I would like the TOC to contain a link "Syllabus" directly to "syllabus.md," and then an expandable box called "Lectures" with links to a bunch of individual lecture markdown files.

For example, you might hope that this would work, but the Lectures section just doesn't show up:

chapters:
- file: syllabus
parts:
  - caption: Lectures
    chapters:
    - file: Lectures/Lecture1.md
    - file: Lectures/Lecture2.md
@ryanlovett
Copy link
Contributor

Yes, if I understand you correctly. This worked in testing:

chapters:
- file: syllabus
- file: Lectures
  sections:
  - file: Lectures/Lecture1.md
  - file: Lectures/Lecture2.md

Here is what is looked like with additional files:
Screenshot 2023-11-28 at 10 08 01 AM

MyST uses the jupyter-book table of contents structure, and this particular feature is documented at https://jupyterbook.org/en/stable/structure/toc.html#use-chapter-sub-sections.

If you want Lectures to only be a TOC heading and not be a landing page, I'll do a bit more digging.

@rgiordan
Copy link
Author

I think this is workable. But you're right --- Lectures needs to be a file. If it's not (e.g., if it is the name of a directory, as in my case), the TOC just skips it, as you can see in this screenshot (which was generated with your TOC code):

Screenshot from 2023-11-28 11-41-17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants