From 1d4694e7d4a53fdaf6742bc3a9f0d3d72a002ddb Mon Sep 17 00:00:00 2001 From: Ferafiks Date: Sat, 21 Nov 2026 13:22:18 +0100 Subject: [PATCH 1/2] fix: Inactive tabs being hidden on PDF documentation --- templates/modern/src/markdown.scss | 7 +++++++ templates/modern/src/markdown.ts | 20 +++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/templates/modern/src/markdown.scss b/templates/modern/src/markdown.scss index 23c801606f4..abe1ed4a057 100644 --- a/templates/modern/src/markdown.scss +++ b/templates/modern/src/markdown.scss @@ -111,3 +111,10 @@ pre { border-top-right-radius: 0; } } + +@media print { + div.tabGroup > section { + display: flex !important; + margin-bottom: 1rem; + } +} diff --git a/templates/modern/src/markdown.ts b/templates/modern/src/markdown.ts index c8d6c4dde32..b2d3ef0777d 100644 --- a/templates/modern/src/markdown.ts +++ b/templates/modern/src/markdown.ts @@ -451,10 +451,28 @@ function renderTabs() { } function updateTabStyle() { - document.querySelectorAll('div.tabGroup>ul').forEach(e => e.classList.add('nav', 'nav-tabs')) + document.querySelectorAll('div.tabGroup>ul').forEach(e => e.classList.add('nav', 'nav-tabs', 'd-print-none')) document.querySelectorAll('div.tabGroup>ul>li').forEach(e => e.classList.add('nav-item')) document.querySelectorAll('div.tabGroup>ul>li>a').forEach(e => e.classList.add('nav-link')) document.querySelectorAll('div.tabGroup>section').forEach(e => e.classList.add('card')) + // Create hidden tab nav that show up when printing + const parser = new DOMParser() + document.querySelectorAll('div.tabGroup').forEach(e => { + const navigation = e.querySelector('ul') + const sections = e.getElementsByTagName('section') + for (let i = 0; i < sections.length; i++) { + const newNav = e.insertBefore(parser.parseFromString(navigation.outerHTML, 'text/html').body.firstElementChild, sections[i]) + console.log(newNav) + newNav.classList.remove('d-print-none') + newNav.classList.add('d-none', 'd-print-flex') + for (let j = 0; j < newNav.children.length; j++) { + newNav.children[j].firstElementChild.classList.remove('active') + if (j === i) { + newNav.children[j].firstElementChild.classList.add('active') + } + } + } + }) } function notifyContentUpdated() { From dec6aefeb268b85fe3583a45f9a374b08a5c757f Mon Sep 17 00:00:00 2001 From: Ferafiks Date: Wed, 2 Dec 2026 12:17:55 +0100 Subject: [PATCH 2/2] fix: Adressed review --- templates/modern/src/markdown.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/templates/modern/src/markdown.ts b/templates/modern/src/markdown.ts index b2d3ef0777d..4ab0db2a71a 100644 --- a/templates/modern/src/markdown.ts +++ b/templates/modern/src/markdown.ts @@ -459,13 +459,20 @@ function renderTabs() { const parser = new DOMParser() document.querySelectorAll('div.tabGroup').forEach(e => { const navigation = e.querySelector('ul') - const sections = e.getElementsByTagName('section') + const sections = [] + const children = Array.from(e.children) + Array.from(children).forEach(c => { + if (c.tagName === 'SECTION') { + sections.push(c) + } + }) for (let i = 0; i < sections.length; i++) { const newNav = e.insertBefore(parser.parseFromString(navigation.outerHTML, 'text/html').body.firstElementChild, sections[i]) - console.log(newNav) newNav.classList.remove('d-print-none') newNav.classList.add('d-none', 'd-print-flex') for (let j = 0; j < newNav.children.length; j++) { + newNav.children[j].classList.remove('active') + newNav.children[j].removeAttribute('hidden') newNav.children[j].firstElementChild.classList.remove('active') if (j === i) { newNav.children[j].firstElementChild.classList.add('active')