Replace old docs with new docs repo (#24201)

This commit is contained in:
Lydia Hallie
2025-11-05 11:14:21 -08:00
committed by GitHub
parent 550522e99b
commit 1606a9f24e
407 changed files with 21970 additions and 17527 deletions

View File

@@ -0,0 +1,44 @@
(function () {
function normalizeInternalLinks() {
const selectors = [
'a[href*="bun.com/docs/installation"]',
'a[href="https://bun.com/reference"]',
'a[href="https://bun.com/blog"]',
];
selectors.forEach(selector => {
const elements = document.querySelectorAll(selector);
elements.forEach(element => {
if (element.hasAttribute("target")) {
element.removeAttribute("target");
// Also remove rel="noreferrer" if present, typically paired with target="_blank"
if (element.getAttribute("rel") === "noreferrer") {
element.removeAttribute("rel");
}
console.log(`Removed target="_blank" from: ${element.textContent || element.innerHTML.substring(0, 50)}`);
}
});
});
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", normalizeInternalLinks);
} else {
normalizeInternalLinks();
}
const observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.type === "childList" || mutation.type === "attributes") {
normalizeInternalLinks();
}
});
});
observer.observe(document.body, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ["target", "href"],
});
})();