Skip to content

Fix Copy Markdown button path resolution#58

Closed
Copilot wants to merge 4 commits intomasterfrom
copilot/fix-copy-markdown-button-another-one
Closed

Fix Copy Markdown button path resolution#58
Copilot wants to merge 4 commits intomasterfrom
copilot/fix-copy-markdown-button-another-one

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

The Copy Markdown button fails with "Page not found" because path matching doesn't account for file extensions.

Issue

page.path from the component includes extensions (model/mac/biba.mdx), but source.getPages() returns paths without them (model/mac/biba), causing lookup to fail.

Changes

  • Strip .mdx/.md extensions during path normalization in getMarkdownContent()
// Before matching against fumadocs pages
normalizedPath = normalizedPath.replace(/\.mdx?$/, "");

This aligns the incoming path format with fumadocs' internal representation before the lookup.

Original prompt

This section details on the original issue you should resolve

<issue_title>[bug] "Copy Markdown" button doesn't work</issue_title>
<issue_description>in docs page like: https://www.casbin.org/docs/biba, "Copy Markdown" button doesn't work, it shows error:

Failed to copy the markdown to your clipboard. Please copy it manually.

need to fix</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@netlify
Copy link

netlify bot commented Feb 1, 2026

Deploy Preview for casbin-website-v3 ready!

Name Link
🔨 Latest commit 8f1616e
🔍 Latest deploy log https://app.netlify.com/projects/casbin-website-v3/deploys/697f4ae09772c800089f1d36
😎 Deploy Preview https://deploy-preview-58--casbin-website-v3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
@nomeguy nomeguy marked this pull request as ready for review February 1, 2026 12:43
Copilot AI and others added 2 commits February 1, 2026 12:43
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix 'Copy Markdown' button not working on docs page Fix Copy Markdown button path resolution Feb 1, 2026
Copilot AI requested a review from nomeguy February 1, 2026 12:48
@nomeguy nomeguy closed this Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] "Copy Markdown" button doesn't work

3 participants