fix: Apply various suggestions from @martinthomson (#4849)

* With bs 5.2.3, no need to rewrite dots in ids and hrefs.

* Remove leftover console.log().

* Inherit color for <code>

* Don't wrap boilerplate URLs; makes it look more like text version.
This commit is contained in:
Lars Eggert 2022-12-08 16:58:28 +02:00 committed by GitHub
parent 83771aceb3
commit efb9f135c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 17 deletions

View file

@ -104,7 +104,7 @@ $tooltip-margin: inherit !default;
code {
font-size: 1em;
color: var(--bs-body-color);
color: inherit;
}
@media screen {

View file

@ -70,6 +70,11 @@ blockquote {
border-left: 2px solid darkgrey;
}
// Don't wrap boilerplate URLs; makes it look more like text version.
:is(#status-of-memo, #copyright) a[href] {
white-space: nowrap;
}
/* Header junk */
#external-metadata {
display: none !important; /* metadata.min.js is evil because it produces unstyleable goop */

View file

@ -38,21 +38,6 @@ document.addEventListener("DOMContentLoaded", function (event) {
});
});
// Rewrite ids and hrefs to not contains dots (bug in bs5.2 scrollspy)
// See https://github.com/twbs/bootstrap/issues/34381
// TODO: check if this can be removed when bs5 is updated
const ids = document.querySelectorAll(
"#content [id^=section-], #content [id^=appendix-]");
[...ids].map(id_el => id_el.id = id_el.id.replaceAll(/\./g, "-"));
const hrefs = document.querySelectorAll(
"#content [href*='#section-'], #content [href*='#appendix-']"
);
[...hrefs].map(id_el => {
const href = new URL(id_el.href);
href.hash = href.hash.replaceAll(/\./g, "-");
id_el.href = href.href;
});
// Set up a nav pane
const toc_pane = document.getElementById("toc-nav");
populate_nav(toc_pane,

View file

@ -89,7 +89,6 @@ export function populate_nav(nav, heading_selector, classes) {
document.addEventListener("scroll", debounce(function () {
const items = nav.querySelectorAll(".active");
const item = [...items].pop();
console.log(item);
if (item) {
item.scrollIntoView({
block: "center",