[Feature] Toc's for subheadings
For long pages where some subheadings may contain a lot of data, it would be helpful to be able to create a TOC for a single heading. Syntactically, I'd envision this like: ``` toc toc_heading: "## my subheading" ```
In my case, I have pages for various pieces of software and a heading for courses with each course under it. It would be useful to be able to navigate this note sections with their own TOC.
Example page
# Java
## Install
...
## Frequent functions
..
## Courses
``` toc
toc_heading: "## Courses"
\```
### Course 1
#### Module 1
...
##### Section 1
...
### Course 2
...
Conversely, it might also be helpful to have an ignore heading function, where a heading and subheading may be left out of the TOC.
Thanks
Hey @tagd , I refined the feature request based on your original post. Can you tell me if I understand this correctly?
Thanks!
Example 1: Generate a TOC for a specific section only
Goal: You want a TOC for just one section, not the whole document — for example, only under ## Courses.
Example markdown
# Java
## Install
Some installation steps...
## Frequent functions
Common function references...
## Courses
```toc
toc_heading: "## Courses"
Course 1 Module 1 Section 1 Section 2 Module 2 Section 1 Course 2 Module 1 Section 1
### 🔍 Expected plugin behavior
When the plugin sees:
```toc
toc_heading: "## Courses"
…it searches for the heading ## Courses, then scans only the content under that heading until the next top-level section (or end of file).
The generated TOC would look like:
**Table of Contents (Courses)**
- [Course 1](#course-1)
- [Module 1](#module-1)
- [Section 1](#section-1)
- [Section 2](#section-2)
- [Module 2](#module-2)
- [Section 1](#section-1-1)
- [Course 2](#course-2)
- [Module 1](#module-1-1)
- [Section 1](#section-1-2)
This lets you have localized TOCs within long documents.