Add docusaurus-plugin-copy-page-button - #342
Conversation
|
@portdeveloper is attempting to deploy a commit to the OsmoLabs Team on Vercel. A member of the Team first needs to authorize it. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Thanks for this, and for the clear writeup. The underlying goal (making the docs easy to hand to an LLM) is one we care about and will address once the current content pass is finished. Not 100% on the need to expose this to a user to then copy across to an LLM. At the moment, we're looking more at ways to make the docs work better without a human intermediary, rather than simplifying by having a human copy across pages into context. On review, generateMarkdownRoutes is the feature that would help with this, but it's off by default and didn't work on our setup. When we enabled generateMarkdownRoutes: true and rebuilt, it emitted zero .md files. We're going to hold this PR for now, rather than merge the button alone, until after the content sweep, and look into alternative methods for making docs more palatable to LLMs for comparison. |
|
appreciate the detailed feedback — the "no human intermediary" framing is the right one, and dug into it: your site sets fixed in totally reasonable to hold until after the content sweep. whenever you revisit, bumping to |
|
Wanted to be straight with you about where we landed, since you put real work in here. We added a small first-party build step (now merged: #351). It generates the same thing, per-page Thank you for raising this with us and the contribution though, this was real missing functionality that if we hadn't had on the radar already would have been really useful with the increasing usage of LLMs for most work. |
Add scripts/gen-llms.mjs (run as a postbuild step) that reads the source
markdown under docs/ and emits, into the build output:
- build/<route>.md a clean plain-markdown copy of every page, served
raw at the page URL + .md (no nav chrome, no JS)
- build/llms.txt a grouped index of every page and its .md URL
Source-derived rather than HTML-scraped, so it is robust against our
swizzled routeBasePath:'/' theme (the approach that produced zero output
for the scraping-based plugin in PR osmosis-labs#342). Strips MDX chrome (theme
imports, Tabs/TabItem, <p align> image wrappers, admonition fences) only
outside code fences, so placeholder tokens and code examples survive.
Correctness of the generated corpus:
- Rewrites relative links/images to absolute paths, since index/README
pages are served one directory shallower than their source file.
Inter-page links point at the target's .md (not the HTML route) so an
agent following a link stays in the markdown corpus; images map to the
hashed asset Docusaurus emits under /assets/images.
- Expands <DocCardList/> into a markdown list of child pages (title +
description, linked to each child's .md) so section-landing navigation
is preserved.
- Adds llms.txt entries for content routes outside docs/ (home, /api,
which have no markdown source) and reports honest sitemap coverage
(with-markdown vs indexed-HTML-only vs excluded vs uncovered),
deliberately excluding utility routes (/search, /api/v2,
/category/key-management).
build/ is gitignored, so only the generator is tracked.
This PR
why useful for Osmosis specifically:
the integrate/ and validate/ sections carry a lot of per-page nuance — pools, IBC transfers, CosmWasm, running and upgrading nodes. the typical flow for someone building against Osmosis or standing up a validator is reading a docs page → wanting to drop just that page into an LLM to scaffold the integration or debug a setup. this saves the selection-and-cleanup step.
zero config, auto-injects into the TOC sidebar, theme-aware. (noticed you swizzle DocSidebar — the button injects near the TOC on the right, so it won't touch your left-nav customizations.)
shipping on React Native, Redux Toolkit, Puppeteer, pnpm, PlayCanvas, Arbitrum, Cardano, Sui, Nillion, Flare, Kaia, and ~20 other docs sites. listed on the Docusaurus community plugins page.
happy to close/rebase if not a fit