fix: Unbreak HTMLized table of contents (#5486)

Fixes #5483
This commit is contained in:
Lars Eggert 2023-04-13 01:34:30 +03:00 committed by GitHub
parent 716a77a848
commit 0f1a774b79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View file

@ -42,10 +42,8 @@ document.addEventListener("DOMContentLoaded", function (event) {
// Set up a nav pane // Set up a nav pane
const toc_pane = document.getElementById("toc-nav"); const toc_pane = document.getElementById("toc-nav");
populate_nav(toc_pane, const headings = document.querySelectorAll(`#content :is(h2, h3, h4, h5, h6, .h2, .h3, .h4, .h5, .h6)`);
`#content h2, #content h3, #content h4, #content h5, #content h6 populate_nav(toc_pane, headings, ["py-0"]);
#content .h1, #content .h2, #content .h3, #content .h4, #content .h5, #content .h6`,
["py-0"]);
// activate pref buttons selected by pref cookies or localStorage // activate pref buttons selected by pref cookies or localStorage
const in_localStorage = ["deftab", "reflinks"]; const in_localStorage = ["deftab", "reflinks"];

View file

@ -152,7 +152,7 @@ $(document)
$(function () { $(function () {
const contentElement = $('#content.ietf-auto-nav'); const contentElement = $('#content.ietf-auto-nav');
if (contentElement.length > 0) { if (contentElement.length > 0) {
const heading_selector = ":is(h2, h3, h4, h5, h6, .nav-heading):not([style='display:none']):not(.navskip)"; const heading_selector = ":is(h2, h3, h4, h5, h6, .h2, .h3, .h4, .h5, .h6, .nav-heading):not([style='display:none']):not(.navskip)";
const headings = contentElement const headings = contentElement
.find(heading_selector) .find(heading_selector)
.filter((i, el) => !el.closest(".navskip")); .filter((i, el) => !el.closest(".navskip"));