diff --git a/build/ui-bundle.zip b/build/ui-bundle.zip index 4959432..68473e4 100644 Binary files a/build/ui-bundle.zip and b/build/ui-bundle.zip differ diff --git a/src/helpers/md-url.js b/src/helpers/md-url.js index cebd958..f99b529 100644 --- a/src/helpers/md-url.js +++ b/src/helpers/md-url.js @@ -2,6 +2,20 @@ /** * Map an Antora HTML page URL to its LLM Markdown twin. - * Example: /savanna/main/overview/index.html → /savanna/main/overview/index.md + * + * Handles both URL styles: + * /savanna/main/overview/index.html → /savanna/main/overview/index.md + * /savanna/main/overview/ → /savanna/main/overview/index.md + * /savanna/main/overview/pricing → /savanna/main/overview/pricing.md */ -module.exports = (url) => (typeof url === 'string' ? url.replace(/\.html(?=[#?]|$)/, '.md') : url) +module.exports = (url) => { + if (typeof url !== 'string') return url + const match = /^(.*?)([?#].*)?$/.exec(url) + const path = match[1] + const rest = match[2] || '' + if (/\.md$/i.test(path)) return url + if (/\.html$/i.test(path)) return path.replace(/\.html$/i, '.md') + rest + if (path.endsWith('/')) return path + 'index.md' + rest + if (!path) return url + return path + '.md' + rest +}