Skip to content

feat: add copy-link action to copy the page's .md URL#9

Open
azizbecha wants to merge 1 commit into
portdeveloper:mainfrom
azizbecha:feat/copy-link-action
Open

feat: add copy-link action to copy the page's .md URL#9
azizbecha wants to merge 1 commit into
portdeveloper:mainfrom
azizbecha:feat/copy-link-action

Conversation

@azizbecha

Copy link
Copy Markdown

Summary

Adds a copy-link dropdown 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 .md file — 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 honours markdownUrl / generateMarkdownRoutes. On a site that serves per-page markdown it copies the .md link; otherwise it falls back to the page URL (the same degradation as the AI actions).

Changes

  • New copy-link item in allDropdownItems, backed by a small copyMarkdownLink action (reuses resolveContextUrl + writeTextToClipboard).
  • Added 'copy-link' to DEFAULT_ACTIONS.
  • ActionId 'copy-link' and labels.copyLink added to react.d.ts and index.d.ts.
  • README (available actions, default list, i18n table) and CHANGELOG updated.

Notes / open question

  • Default-on: I added it to 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 from DEFAULT_ACTIONS) — your call.
  • Labels default to Copy link to Markdown / Copy this page's .md URL, overridable via labels.copyLink and i18n ids copyPageButton.copyLink.*.

Test plan

  • npm test passes (existing postBuild route-generation tests).
  • Component parses as valid JSX; the new item mirrors the existing view item's structure.
  • Manually verified the action copies the resolved markdown URL.

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`.
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.

1 participant