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

Provide nesting in TOC for sections #226

Closed
stevejpurves opened this issue Aug 24, 2023 · 1 comment
Closed

Provide nesting in TOC for sections #226

stevejpurves opened this issue Aug 24, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@stevejpurves
Copy link
Contributor

Context

Given a valid _toc.yml of:

format: jb-book
root: index
parts:
  - caption: Tutorials
    chapters:
      - file: tutorial1
      - file: tutorial2
        sections:
          - file: tutorial2.1
          - file: tutorial2.2
      - file: tutorial3

mystmd produces a TOC data structure that reflects grouping and nesting via the level field:

"pages": [
{
"title": "Tutorials",
"level": 1
},
{
"slug": "tutorial1",
"title": "TUTORIAL 1",
...,
"level": 2
},
{
"slug": "tutorial2",
"title": "TUTORIAL 2",
...,
"level": 2
},
{
"slug": "tutorial2-1",
"title": "TUTORIAL 2.1",
...,
"level": 3
},
{
"slug": "tutorial2-2",
"title": "TUTORIAL 2.2",
...,
"level": 3
},
{
"slug": "tutorial3",
"title": "TUTORIAL 3",
...,
"level": 2
}
]

But the myst theme TOC does not show this nesting.

image

Proposal

  1. nest the TOC items in line with the level reported in the data structure
  2. enable expand/collapse controls for items level > 2

Tasks and updates

No response

@stevejpurves stevejpurves added the enhancement New feature or request label Aug 24, 2023
@rowanc1
Copy link
Member

rowanc1 commented Nov 14, 2023

An initial take was put into #254. I think there are still some things to do, but that should fix this specific issue.

@rowanc1 rowanc1 closed this as completed Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants