Skip to content

feat(docs): add copy-to-llm button for easy AI tool integration - #2541

Merged
anistark merged 3 commits into
vibrantlabsai:mainfrom
sanjeed5:feat/docs-copy-to-llm-button-v2
Dec 30, 2025
Merged

feat(docs): add copy-to-llm button for easy AI tool integration#2541
anistark merged 3 commits into
vibrantlabsai:mainfrom
sanjeed5:feat/docs-copy-to-llm-button-v2

Conversation

@sanjeed5

Copy link
Copy Markdown
Contributor

Summary

  • Adds mkdocs-copy-to-llm plugin to documentation pages
  • Enables users to easily copy page content for use with AI coding tools (ChatGPT, Claude, Cursor, etc.)
  • Includes dark mode styling to match Material for MkDocs theme

Changes

  • pyproject.toml: Added mkdocs-copy-to-llm to docs dependency group
  • mkdocs.yml: Configured plugin with repo URL and button options
  • docs/extra/ragas-modern.css: Added dark mode styling for the copy button

Notes

Test plan

  • Run make serve-docs and verify the "Copy page" button appears on doc pages
  • Test copy functionality in both light and dark modes
  • Verify button styling matches the theme

Add mkdocs-copy-to-llm plugin to documentation pages, enabling users to
easily copy page content for use with AI coding tools like ChatGPT, Claude,
and Cursor.

- Add mkdocs-copy-to-llm dependency to docs group
- Configure plugin with repo URL and button options
- Add dark mode styling for the copy button to match Material theme
- Disable broken link features until upstream plugin fix (issue vibrantlabsai#24)

@anistark anistark 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.

It might be due to my browser cache. But the copy button only appears when I refresh page. And not when navigating.

Maybe test it out more and confirm.

Looks good overall.

Comment thread docs/extra/ragas-modern.css Outdated
/* Copy to LLM button - dark mode styling */
[data-md-color-scheme="slate"] .copy-to-llm-split-container {
--mystic: #404040;
--white: #2d2d2d;

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.

Lets follow the same styling convention of dark/light. white/black will be confusing.

@sanjeed5

Copy link
Copy Markdown
Contributor Author

Regarding the copy button not appearing on navigation (only on refresh):

This is a known issue with the mkdocs-copy-to-llm plugin's compatibility with MkDocs Material's instant navigation feature. I've raised a fix upstream:

PR: leonardocustodio/mkdocs-copy-to-llm#25

Root cause: The plugin was using DOMContentLoaded + MutationObserver which don't work with instant navigation because the entire content container is replaced via XHR without a full page reload.

Fix: Subscribe to Material's document$ observable which emits on every content change.

Once merged and released, updating the plugin version should resolve the issue.

Rename confusing color-based variable names to semantic names that
describe their purpose:

- --white → --copy-llm-surface (background color)
- --black → --copy-llm-text (text/foreground color)
- --mystic → --copy-llm-border (border color)
- --athens-gray → --copy-llm-hover-overlay (hover effect)

Also refactored to actually use the CSS variables instead of
hardcoding the same hex values repeatedly.
Keep both plugins:
- copy-to-llm: adds "Copy page" button for easy LLM tool integration
- llmstxt: generates llms.txt file for LLM-friendly documentation

Both plugins serve complementary purposes.
@anistark

Copy link
Copy Markdown
Member

Once merged and released, updating the plugin version should resolve the issue.

Sounds good. Can you please open an issue to track the PR and next release to update the version ?

We can merge this and track rest on the issue.

@anistark anistark 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.

LGTM. Please open the issue to track next release @sanjeed5

@anistark
anistark merged commit 3665494 into vibrantlabsai:main Dec 30, 2025
9 checks passed
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