Skip to content

Commit 3c4bb1f

Browse files
committed
fix: copy markdown link uses .md URL
1 parent 8628675 commit 3c4bb1f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/nimiq-vitepress-theme/src/composables/useSourceCode.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ export function useSourceCode() {
139139
}
140140

141141
const pageTitle = page.value.title || document.title || 'Documentation Page'
142-
const currentURL = window.location.href
143-
const markdownLink = `[${pageTitle}](${currentURL})`
142+
const currentPath = window.location.pathname
143+
const markdownPath = currentPath.replace(/\.html$/, '.md').replace(/\/$/, '/index.md')
144+
const markdownUrl = `${window.location.origin}${markdownPath}`
145+
const markdownLink = `[${pageTitle}](${markdownUrl})`
144146

145147
await copy(markdownLink)
146148
toast.success('Markdown link copied to clipboard')

0 commit comments

Comments
 (0)