'Markdown to create a collapsible table of contents
I'm new to markdown and I'm writing a README.md
file in Github. I know how to create a table of contents with markdown and also a separate collapsible section.
Is there a way to create a collapsible table of contents with markdown? (A table of contents, which can be collapsed by the user's click.)
## Table of Contents
- [Regex](#regex)
<details>
<summary>Table of Contents</summary>
- I want to add a link to the *Regex* section in my markdown.
</details>
### Regex
The details will be here...
Solution 1:[1]
From what I see, it looks like you want the 'Table of Contents' to be a heading. While I don't know how to do make a heading collapsible, you can work around that by styling your summary to look like a heading this way:
<style>
#tableOfContents {
font-size: 1.5em;
}
</style>
<p>
<details>
<summary id="tableOfContents">Table of Contents</summary>
- [Regex](#regex)
</details>
</p>
### Regex
The details will be here..
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |