Skip to content

Add "Copy page" dropdown to docs pages (copy as Markdown / view raw Markdown) #2486

Description

@brandonroberts

Which scope/s are relevant/related to the feature request?

Docs

Information

Add a "Copy page" split-button/dropdown to the header of each docs page (next to the page title), following the pattern popularized by other framework docs sites. The dropdown would offer:

  • Copy page as Markdown — copies the page's raw Markdown source to the clipboard, useful for pasting into LLMs, issues, and discussions with formatting intact.
  • View as Markdown — opens the raw Markdown for the page at a stable URL, e.g. https://analogjs.org/docs/<slug>.md.

This makes docs content easy to feed into AI assistants and to reference/quote elsewhere, and the .md URLs pair naturally with llms.txt conventions.

Implementation notes

  • The copy action is nearly free: docs pages already receive the raw Markdown client-side via injectContent() (doc.content is the Markdown string), so it's a navigator.clipboard.writeText() call plus a small standalone component. Frontmatter would be stripped, prepending # {title} instead.
  • The component follows the existing docs theme and patterns: a standalone component in src/app/docs/components/ styled with Tailwind utilities and the docs theme CSS variables (--border, --fg-muted, etc.), consistent with existing components like the theme toggle and locale picker, and working in both light and dark themes.
  • The view as Markdown action emits the raw .md files as static assets at /docs/<slug>.md during the existing prerender step. Localized pages (/es/docs/..., /de/docs/...) resolve to their localized source.
  • The dropdown leaves room for future entries (e.g. "Open in ChatGPT/Claude" deep links), out of scope initially.

Prior art

Describe any alternatives/workarounds you're currently using

Manually copying rendered HTML from the browser (loses formatting/code fences) or finding the source .md in the GitHub repo by hand.

I would be willing to submit a PR to fix this issue

  • Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions