Skip to content

Commit 3838b70

Browse files
raifdmuellerclaude
andcommitted
fix: Convert AsciiDoc cross-reference links to router navigation
AsciiDoc cross-references (<<anchor-id,text>>) were generating simple hash links (#anchor-id) which don't work with our hash-based routing (#/anchor/anchor-id). Now intercept clicks on these internal links and convert them to proper router navigation. This fixes the user-reported issue: "die links innerhalb von ankern funktionieren nicht" (links within anchors don't work). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent badff0b commit 3838b70

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

website/src/components/anchor-modal.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@ export async function loadAnchorContent(anchorId) {
139139
details.setAttribute('open', '')
140140
})
141141

142+
// Convert internal AsciiDoc cross-reference links to router navigation
143+
contentEl.querySelectorAll('a[href^="#"]').forEach(link => {
144+
const href = link.getAttribute('href')
145+
// Only process simple hash links (cross-references), not hash routes
146+
if (href && href.startsWith('#') && !href.startsWith('#/')) {
147+
const anchorId = href.substring(1) // Remove the '#'
148+
link.addEventListener('click', (e) => {
149+
e.preventDefault()
150+
// Navigate to the linked anchor
151+
window.location.hash = `#/anchor/${anchorId}`
152+
})
153+
}
154+
})
155+
142156
} catch (error) {
143157
console.error('Error loading anchor content:', error)
144158
titleEl.textContent = 'Error'

0 commit comments

Comments
 (0)