feat: add copy-link action to copy the page's .md URL#9
Open
azizbecha wants to merge 1 commit into
Open
Conversation
Adds a `copy-link` dropdown action that copies a link to the current page's Markdown to the clipboard. It resolves the same URL the "Open in ChatGPT/ Claude/…" actions reference (honouring `markdownUrl` / `generateMarkdownRoutes`), so on sites that serve per-page markdown it copies the `.md` link rather than the HTML page URL. - wire the action into allDropdownItems + DEFAULT_ACTIONS - add ActionId 'copy-link' and labels.copyLink to react.d.ts / index.d.ts - document in README and CHANGELOG Enabled by default; configurable via `enabledActions` and `labels.copyLink`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
copy-linkdropdown action that copies a link to the current page's Markdown (.md) URL to the clipboard.Today the dropdown can open the markdown (
view→ "View as Markdown") or copy the rendered content (copy→ "Copy page"), but there's no way to grab a link to the.mdfile — you have to open it and copy the address bar. This adds that as a one-click action.It resolves the URL through the existing
resolveContextUrl, i.e. the same URL the "Open in ChatGPT/Claude/…" actions reference, so it honoursmarkdownUrl/generateMarkdownRoutes. On a site that serves per-page markdown it copies the.mdlink; otherwise it falls back to the page URL (the same degradation as the AI actions).Changes
copy-linkitem inallDropdownItems, backed by a smallcopyMarkdownLinkaction (reusesresolveContextUrl+writeTextToClipboard).'copy-link'toDEFAULT_ACTIONS.ActionId'copy-link'andlabels.copyLinkadded toreact.d.tsandindex.d.ts.Notes / open question
DEFAULT_ACTIONS, so the item shows for existing consumers on upgrade. If you'd rather avoid a default UX change, I'm happy to make it opt-in (just drop it fromDEFAULT_ACTIONS) — your call.Copy link to Markdown/Copy this page's .md URL, overridable vialabels.copyLinkand i18n idscopyPageButton.copyLink.*.Test plan
npm testpasses (existingpostBuildroute-generation tests).viewitem's structure.