Skip to content

Commit

Permalink
fix: collapse does not work as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
cqroot committed Sep 11, 2022
1 parent 5fa4f25 commit 31a9217
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/panelHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default async function panelHtml(headers: any[]) {

if (collapsible) {
let suffix: string = '';
let toggleElem: string = '<span>&ensp;<span>';
let toggleElem: string = '<span>&ensp;</span>';

if (headerIdx >= headers.length - 1) {
// Last element
Expand All @@ -88,7 +88,7 @@ export default async function panelHtml(headers: any[]) {
suffix = suffix.concat(`<div id="toc-group-${header.number}">`);
divsToClose.push(nextHeader.level);
} else if (header.level > nextHeader.level) {
while (divsToClose[divsToClose.length - 1] >= nextHeader.level) {
while (divsToClose[divsToClose.length - 1] > nextHeader.level) {
suffix = suffix.concat('</div>');
divsToClose.splice(divsToClose.length - 1, 1);
}
Expand Down

0 comments on commit 31a9217

Please sign in to comment.