DEV Community

Cover image for I built a copy-for-LLMs button for Docusaurus. Then Ethereum and Sui shipped it.
port
port

Posted on

I built a copy-for-LLMs button for Docusaurus. Then Ethereum and Sui shipped it.

*A few months ago I got tired of selecting docs pages and pasting them into Claude. Half the time the nav came along with the content. So I built docusaurus-plugin-copy-page-button: a one-line install that drops a Copy page button into your Docusaurus sidebar.
*

When I click the button, I get the page as clean markdown. I also added a dropdown that opens the page directly in ChatGPT, Claude, or Gemini.

Setup:

npm install docusaurus-plugin-copy-page-button

Then one line in docusaurus.config.js:

plugins: ['docusaurus-plugin-copy-page-button']

That's it.

Six months later, I see the plugin running on:

  • Ethereum execution-apis
  • Sui, Walrus, Seal, SuiNS (Mysten Labs)
  • Monad
  • Flare
  • Kaia
  • Nillion
  • Chronicle

Around 10k installs a month, mostly blockchain ecosystems. I didn't aim at that niche, it just landed there.

What was actually hard

Three things took most of the time.

Content extraction. Docusaurus pages come wrapped in nav, breadcrumbs, edit-this-page links, footers, and a sidebar. The plugin walks the DOM, finds the article container, drops the chrome, and hands the rest to a markdown converter that handles code blocks, tables, lists, and admonitions.

Then SPA route changes. Docusaurus uses client-side navigation. Inject the button on first load and it vanishes when the user clicks a link. The plugin watches popstate, Docusaurus's own events, and URL changes, then re-injects on each route.

And mobile. Docusaurus collapses the TOC sidebar on small screens. The button needs to live somewhere visible without breaking the layout. Took a few iterations.

Try it

If you run a Docusaurus site, install it. If something's missing, open an issue.

Top comments (0)