Skip to content

add docusaurus-plugin-copy-page-button#5299

Merged
markerikson merged 2 commits into
reduxjs:masterfrom
portdeveloper:add-copy-page-button
Jun 8, 2026
Merged

add docusaurus-plugin-copy-page-button#5299
markerikson merged 2 commits into
reduxjs:masterfrom
portdeveloper:add-copy-page-button

Conversation

@portdeveloper

Copy link
Copy Markdown
Contributor

This PR
adds docusaurus-plugin-copy-page-button to website/package.json
adds the plugin string to plugins in website/docusaurus.config.ts
puts a "Copy page" button in the docs sidebar — exports current page as clean markdown
adds one-click "Open in Claude / ChatGPT / Gemini" actions that prefill the markdown

why useful for RTK specifically:
RTK Query, createSlice, listener middleware all have a lot of subtle nuance per page. the typical "I want to ask claude about this" flow is reading a docs page → wanting to drop just that page in for context. this saves the selection-and-cleanup step.

zero config, auto-injects into the TOC sidebar, theme-aware.

shipping on Ethereum execution-apis, Sui, Walrus, Seal, SuiNS, Monad, Flare, Kaia, Nillion, Chronicle, Cardano, and Arbitrum docs. listed in the Docusaurus community plugins page.

happy to close/rebase if not a fit

@codesandbox-ci

codesandbox-ci Bot commented May 16, 2026

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8e47026:

Sandbox Source
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration
rtk-esm-cra Configuration

@netlify

netlify Bot commented May 16, 2026

Copy link
Copy Markdown

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit 8e47026
🔍 Latest deploy log https://app.netlify.com/projects/redux-starter-kit-docs/deploys/6a2682ebdc0a49000806f3f5
😎 Deploy Preview https://deploy-preview-5299--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@aryaemami59 aryaemami59 added the Documentation Improvements or additions to documentation label May 18, 2026
@portdeveloper

Copy link
Copy Markdown
Contributor Author

Friendly bump — happy to revise or close if this is not a fit. The docs deploy preview is green; the one red check I can see is the are-the-types-wrong job failing with an internal CLI error (Cannot read properties of undefined reading filename), so it does not look caused by the docs plugin change.

@portdeveloper

Copy link
Copy Markdown
Contributor Author

Quick note: I used my agents to help generate this PR. Feel free to tag me (@portdeveloper) in this thread with any questions and I'll reply asap 🙏

@portdeveloper

Copy link
Copy Markdown
Contributor Author

Friendly nudge on this PR — happy to address any feedback if it'd help land it. The plugin recently shipped on react/react-native-website#5085 and continues to see adoption. Thanks for your time!

@aryaemami59

Copy link
Copy Markdown
Member

Friendly bump — happy to revise or close if this is not a fit. The docs deploy preview is green; the one red check I can see is the are-the-types-wrong job failing with an internal CLI error (Cannot read properties of undefined reading filename), so it does not look caused by the docs plugin change.

See my earlier comment on #5304.

@portdeveloper

Copy link
Copy Markdown
Contributor Author

Oh thanks, checking it rn

portdeveloper added a commit to portdeveloper/docusaurus-plugin-copy-page-button that referenced this pull request Jun 2, 2026
…uto placement

Addresses maintainer feedback on reduxjs/redux-toolkit#5299.

- markdownUrl: point the AI links at per-page markdown you already publish
  (e.g. an llms.txt setup) without generateMarkdownRoutes. Boolean in config
  (options are JSON-serialized into the page); the function form is available
  on the React component prop for non-standard layouts.
- Tracking: emit a 'copy-page-button:action' event ({action, url}) and expose
  data-copy-page-button-container / -trigger / data-copy-page-action attributes
  for analytics.
- placement 'auto' is now deterministic: migrate the button from the in-article
  fallback into the ToC once the sidebar mounts, instead of leaving it stuck
  inline depending on hydration timing.
@portdeveloper

Copy link
Copy Markdown
Contributor Author

shipped all three in 0.8.0 and bumped this pr to it (it was on 0.5.1), so the preview's rebuilt.

tracking: each dropdown action fires a copy-page-button:action event on document with { action, url }, and items carry data-copy-page-action="…" for a delegated dom listener — wire either into analytics.

placement: real bug — under auto, if the toc hadn't mounted by the first attempt the button stuck inline, and that timing varied per load (the inconsistency you saw). fixed: it migrates into the toc as soon as the sidebar mounts. verified on the deploy preview across reloads. for your site i'd set placement: "toc" to pin it to the right rail.

markdownUrl: new option — if your /llm markdown is served at /<path>.md, set markdownUrl: true and the ai links point there (no generateMarkdownRoutes needed). i checked the live site and /introduction/getting-started.md + /llms.txt both 404, so if your markdown lives elsewhere just leave it — the default points the links at the html page, which the ai tools read fine.

before v1: locking these options + an SSR/swizzle mode that renders the button in static html so placement never depends on client injection.

@aryaemami59

Copy link
Copy Markdown
Member

I've opened #5310 and #5309 to resolve CI failures.

@portdeveloper

Copy link
Copy Markdown
Contributor Author

thanks @aryaemami59, really appreciate you opening #5309 and #5310 — saw both landed. since #5309 bumps are-the-types-wrong to 0.18.3 (that was the exact attw/fflate false-positive hitting this pr), a rebase onto main should turn the red check green. happy to rebase now if that helps — just say the word, or merge main in yourself if that's easier on your end 🙏

@portdeveloper portdeveloper force-pushed the add-copy-page-button branch from 1f85c44 to 8e47026 Compare June 8, 2026 08:52
@markerikson

Copy link
Copy Markdown
Collaborator

Okay, seems reasonable. Thanks!

@markerikson markerikson merged commit 8d525e5 into reduxjs:master Jun 8, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants