Skip to content

feat: add llms markdown in doc pages#891

Open
shreya1510ss wants to merge 10 commits into
keploy:mainfrom
shreya1510ss:add-llms-markdown
Open

feat: add llms markdown in doc pages#891
shreya1510ss wants to merge 10 commits into
keploy:mainfrom
shreya1510ss:add-llms-markdown

Conversation

@shreya1510ss

@shreya1510ss shreya1510ss commented Jul 17, 2026

Copy link
Copy Markdown

What has changed?

Every docs page is now also available as plain Markdown, and llms.txt / llms-full.txt are auto-generated at build time — so AI agents (and humans) can grab clean per-page content instead of parsing HTML.

  • Added docusaurus-plugin-llms, configured to generate llms.txt, llms-full.txt, and a .md twin for every doc page (same URL, .md extension).
  • Added a "Copy as Markdown" / "View as Markdown" control under each page title, so the .md file is actually discoverable, not just guessable. Styled with Tailwind utility classes to match this repo's existing convention.
  • Patched docusaurus-plugin-llms (via patch-package, auto-reapplied on install) to fix two real content bugs found during review:
    • Some pages reuse content from another file via MDX imports (e.g. import WhatIsKeploy from '../concepts/what-is-keploy.md'); the plugin only resolved these when the filename had an underscore, so ~7 pages were leaking that raw import/JSX line into their .md output instead of the real text.
    • ~106 pages were also leaking raw React component code (<Tabs>, <ProductTier>, <HowTo>, etc.) into their .md output. Fixed by stripping self-closing component tags entirely and unwrapping paired ones while preserving their real inner content — carefully excluding <YOUR_INGRESS_HOST>-style fill-in-your-own-value placeholders, which look similar but aren't components.
  • Fixed a timer leak in the copy button: a setTimeout resetting its label was never cleared, so it could fire after the component unmounted (React warning) or race itself on repeated clicks.

Fixes https://github.com/keploy/enterprise/issues/2272

How Has This Been Tested?

Ran npm run build then npm run serve — confirmed the build succeeds, llms.txt/llms-full.txt generate correctly, each page's .md twin loads at its matching URL, and the Copy/View buttons work in both light and dark mode.

Preview.Video.mov

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you and congratulations 🎉 for opening your very first pull request in keploy

…Markdown button

Signed-off-by: Shreya Sharma <shreyasharma.1510001@gmail.com>
Signed-off-by: Shreya Sharma <shreyasharma.1510001@gmail.com>
@shreya1510ss shreya1510ss changed the title Add llms markdown feat: add llms markdown in doc pages Jul 17, 2026
@manasmanohar
manasmanohar requested a review from Copilot July 17, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class “LLM-friendly” outputs for the docs site by generating per-page .md twins plus llms.txt / llms-full.txt, and exposes the per-page Markdown via UI actions under each doc title.

Changes:

  • Add and configure docusaurus-plugin-llms to generate llms.txt, llms-full.txt, and per-page Markdown outputs at build time.
  • Add a MarkdownPageActions UI control to “Copy as Markdown” / “View as Markdown” for eligible doc pages.
  • Wire the new control into the DocItem theme and update lockfile for new dependencies.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
yarn.lock Locks new transitive dependencies required by docusaurus-plugin-llms.
package.json Adds docusaurus-plugin-llms dependency.
docusaurus.config.js Configures the plugin to generate llms*.txt and Markdown per doc page.
src/theme/DocItem/index.js Computes .md twin URL and renders Markdown actions under the doc title.
src/components/MarkdownPageActions.js Implements “Copy as Markdown” / “View as Markdown” UI and clipboard logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/MarkdownPageActions.js
…leak

Signed-off-by: Shreya Sharma <shreyasharma.1510001@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

…tripping

Signed-off-by: Shreya Sharma <shreyasharma.1510001@gmail.com>

@manasmanohar manasmanohar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the comments below. Specifics left inline; this one isn't tied to a diff line:

Collides with the llms.txt we already ship.
We already have curated static/llms.txt and static/llms-full.txt (content team's — About Keploy, awards, positioning, curated links). The plugin generates the same two filenames, and its postBuild runs after static/ is copied, so it overwrites them: build/llms.txt is the generated version and the curated content is gone. Net effect — the content team's file is silently replaced, and editing static/llms.txt later would have no effect. The static file also drifts today since it's hand-maintained.
Option: merge both — feed the curated text into the plugin via rootContent/fullRootContent (+ title/description) so it stays on top and the auto-generated index below stays fresh. Needs the curated source moved out of static/ (so it isn't overwritten) and the static copies removed. Worth confirming the exact split with the content team.

Comment thread src/theme/DocItem/index.js Outdated
Comment thread patches/docusaurus-plugin-llms+0.4.0.patch
Comment thread package.json Outdated
Comment thread docusaurus.config.js
[
"docusaurus-plugin-llms",
{
docsDir: "versioned_docs/version-4.0.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docsDir is hardcoded to versioned_docs/version-4.0.0 — will need updating when we cut the next docs version, since the buttons show on whatever the latest version is (gated on isLatestVersion).

Comment thread src/components/MarkdownPageActions.js
Signed-off-by: Shreya Sharma <shreyasharma.1510001@gmail.com>
…button width shift

Signed-off-by: Shreya Sharma <shreyasharma.1510001@gmail.com>
Signed-off-by: Shreya Sharma <shreyasharma.1510001@gmail.com>
This reverts commit da566b4.

Signed-off-by: Shreya Sharma <shreyasharma.1510001@gmail.com>
Signed-off-by: Shreya Sharma <shreyasharma.1510001@gmail.com>
@manasmanohar
manasmanohar requested a review from Copilot July 21, 2026 06:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Comment thread docusaurus.config.js
Comment on lines +205 to +211
docsDir: "versioned_docs/version-4.0.0",
ignoreFiles: ["**/shared/**"],
generateLLMsTxt: true,
generateLLMsFullTxt: true,
generateMarkdownFiles: true,
preserveDirectoryStructure: false,
excludeImports: true,
Comment on lines +179 to +186
// Folder-style permalinks (section landing pages, ending in "/") are
// written by docusaurus-plugin-llms as index.md inside that folder,
// not as <folder>.md -- so the two cases need different URL shapes.
const markdownUrl = showMarkdownActions
? permalink.endsWith("/")
? `${permalink}index.md`
: `${permalink}.md`
: null;
Comment on lines +175 to +177
// .md twins are only generated for the current (4.0.0) version's docs
// (docusaurus-plugin-llms docsDir points at versioned_docs/version-4.0.0),
// and only for real doc pages, not root/category-index pages.
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.

3 participants