Skip to content

Commit 0f1a774

Browse files
authored
fix: Unbreak HTMLized table of contents (ietf-tools#5486)
Fixes ietf-tools#5483
1 parent 716a77a commit 0f1a774

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

ietf/static/js/document_html.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ document.addEventListener("DOMContentLoaded", function (event) {
4242

4343
// Set up a nav pane
4444
const toc_pane = document.getElementById("toc-nav");
45-
populate_nav(toc_pane,
46-
`#content h2, #content h3, #content h4, #content h5, #content h6
47-
#content .h1, #content .h2, #content .h3, #content .h4, #content .h5, #content .h6`,
48-
["py-0"]);
45+
const headings = document.querySelectorAll(`#content :is(h2, h3, h4, h5, h6, .h2, .h3, .h4, .h5, .h6)`);
46+
populate_nav(toc_pane, headings, ["py-0"]);
4947

5048
// activate pref buttons selected by pref cookies or localStorage
5149
const in_localStorage = ["deftab", "reflinks"];

ietf/static/js/ietf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ $(document)
152152
$(function () {
153153
const contentElement = $('#content.ietf-auto-nav');
154154
if (contentElement.length > 0) {
155-
const heading_selector = ":is(h2, h3, h4, h5, h6, .nav-heading):not([style='display:none']):not(.navskip)";
155+
const heading_selector = ":is(h2, h3, h4, h5, h6, .h2, .h3, .h4, .h5, .h6, .nav-heading):not([style='display:none']):not(.navskip)";
156156
const headings = contentElement
157157
.find(heading_selector)
158158
.filter((i, el) => !el.closest(".navskip"));

0 commit comments

Comments
 (0)