Skip to content

Commit

Permalink
fix: Expand contents with toc is expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
kpears201 committed Sep 11, 2024
1 parent b40681a commit 8ddf722
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion languages/markdown/templates/sections/private-events.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Private Events
<details>
<details id="private-events-details">
<summary>View</summary>

${event.list}
Expand Down
2 changes: 1 addition & 1 deletion languages/markdown/templates/sections/private-methods.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Private Methods
<details>
<details id="private-methods-details">
<summary>View</summary>

${method.list}
Expand Down
3 changes: 2 additions & 1 deletion src/macrofier/engine.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,8 @@ function insertTableofContents(content) {
const link = '#' + slug + (count[slug] ? `-${count[slug]}` : '')
toc += ' ' + ' '.repeat(level - 1) + `- [${title}](${link})`
if (title === 'Private Methods' || title === 'Private Events') {
toc += '<details><summary>Show</summary>\n'
let anchor = title === 'Private Methods' ? 'private-methods-details' : 'private-events-details'
toc += '<details ontoggle="document.getElementById(\'' + anchor + '\').open=this.open"><summary>Show</summary>\n'
collapsedContentLevel = level
} else {
toc += '\n'
Expand Down

0 comments on commit 8ddf722

Please sign in to comment.