From fd84f3603317691bec92d74942bd2520e8f1ea63 Mon Sep 17 00:00:00 2001 From: carlospolop Date: Wed, 26 Nov 2025 17:57:33 +0100 Subject: [PATCH] f --- theme/toc.js.hbs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/theme/toc.js.hbs b/theme/toc.js.hbs index 5bc3c97a3..98e817b97 100644 --- a/theme/toc.js.hbs +++ b/theme/toc.js.hbs @@ -10,7 +10,9 @@ class MDBookSidebarScrollbox extends HTMLElement { connectedCallback() { // Modify TOC to support external links var toc = '{{#toc}}{{/toc}}'; - toc = toc.replace(/
([^$<>]*)\$\$external:([^$<>]*)\$\$<\/div>/g, '$1') + // Handle both old mdbook (
) and new mdbook 0.5 () formats + // External links open in new tab with external link icon + toc = toc.replace(/<(div|span)>([^$<>]*)\$\$external:([^$<>]*)\$\$<\/(div|span)>/g, '$2 ↗') this.innerHTML = toc // Set the current, active page, and reveal it if it's hidden let current_page = document.location.href.toString();