Skip to content

Commit 7d2b797

Browse files
committed
Leave Aliki TOC nesting to the heading level change
#1842 fixes the method group nesting by emitting h2 headings in the default section, so the TOC needs no special case for them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gxq9jGyjWoANhMZXRtssiu
1 parent 154185e commit 7d2b797

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

  • lib/rdoc/generator/template/aliki/js

‎lib/rdoc/generator/template/aliki/js/aliki.js‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ function generateToc() {
267267
if (!heading.id) return;
268268

269269
const li = document.createElement('li');
270-
li.className = `toc-item toc-${tocLevel(heading)}`;
270+
const level = heading.tagName.toLowerCase();
271+
li.className = `toc-item toc-${level}`;
271272

272273
const link = document.createElement('a');
273274
link.href = `#${heading.id}`;
@@ -291,17 +292,6 @@ function generateToc() {
291292
}
292293
}
293294

294-
// Constants, Attributes and method group headings are h3 so they nest under a
295-
// titled section's h2. In the untitled section, list them as h2 so they don't
296-
// look like children of the class comment's last heading.
297-
function tocLevel(heading) {
298-
const level = heading.tagName.toLowerCase();
299-
if (level !== 'h3' || !heading.matches('.documentation-section > section > header > h3')) return level;
300-
301-
const section = heading.closest('.documentation-section');
302-
return section.querySelector(':scope > .documentation-section-title') ? level : 'h2';
303-
}
304-
305295
function hookTocActiveHighlighting() {
306296
const tocLinks = document.querySelectorAll('.toc-link');
307297
const targetHeadings = [];

0 commit comments

Comments
 (0)