Skip to content

Add "Copy page" dropdown and Markdown alternate link - #856

Merged
MattiasBuelens merged 5 commits into
mainfrom
devin/1789033579-copy-page-dropdown
Sep 11, 2026
Merged

MattiasBuelens merged 5 commits into
mainfrom
devin/1789033579-copy-page-dropdown

Conversation

@MattiasBuelens

@MattiasBuelens MattiasBuelens commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a "Copy page" dropdown (top right of the breadcrumbs row) on every docs page that gets a companion .md file from the llmsTxt plugin, plus a <link rel="alternate" type="text/markdown"> in the <head>. Resolves OPTIP-479.

Which pages get it. The llmsTxt plugin wrapper now publishes its excludeRoutes globs as plugin global data, compiled with the same micromatch.makeRe the upstream plugin uses:

// src/plugin/llmsTxt.ts
contentLoaded({ actions }) {
  actions.setGlobalData({ excludeRoutes: patterns.map(p => micromatch.makeRe(p).source).join('|') });
}

A client hook useMarkdownUrl() (src/plugin/llmsTxtClient.ts) tests the current pathname against that regex and returns ${siteUrl}${pathname without trailing slash}.md, or undefined for excluded routes (old THEOplayer versions, contributing, search, 404). So the UI and the generated files stay in sync from a single config.

UI. CopyPageDropdown (react-aria-components MenuTrigger / Menu / Popover) takes markdownUrl as a prop:

  • "View as Markdown" — MenuItem href target="_blank"
  • "Copy as Markdown" — fetch(markdownUrl) then navigator.clipboard.writeText, button shows "Copied" for 2s

Each item has a title tooltip with a longer description. MenuItem does not forward title to the DOM, so it is set on an inner <span>.

It is rendered from the swizzled DocBreadcrumbs, which also covers OpenAPI pages (their layout renders @theme/DocBreadcrumbs). DocBreadcrumbs now renders when either breadcrumbs or a Markdown URL exist, and emits the <Head> alternate link.

Note: the .md files are only produced by the post-build step, so the links 404 on npm start. That is expected; they work on a built site.

Copy page dropdown open

Link to Devin session: https://dolby.devinenterprise.com/sessions/d14704b107234c32af5b8625eff5474a
Open in Devin Desktop: https://dolby.devinenterprise.com/desktop/session/d14704b107234c32af5b8625eff5474a?variant=devin
Requested by: @MattiasBuelens

devin-ai-integration Bot and others added 2 commits September 10, 2026 09:53
Co-Authored-By: Mattias Buelens <mattias.buelens@dolby.com>
Co-Authored-By: Mattias Buelens <mattias.buelens@dolby.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@theoplayer-bot

This comment has been minimized.

devin-ai-integration Bot and others added 2 commits September 10, 2026 13:06
Co-Authored-By: Mattias Buelens <mattias.buelens@dolby.com>
Co-Authored-By: Mattias Buelens <mattias.buelens@dolby.com>
Comment thread src/plugin/llmsTxtClient.ts Outdated
Co-Authored-By: Mattias Buelens <mattias.buelens@dolby.com>
@MattiasBuelens
MattiasBuelens merged commit 8826784 into main Sep 11, 2026
4 checks passed
@MattiasBuelens
MattiasBuelens deleted the devin/1789033579-copy-page-dropdown branch September 11, 2026 09:06
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.

2 participants