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

## 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

- Some link-related features (`copy_markdown_link`, `view_as_markdown`)
are temporarily disabled due to an upstream plugin bug:
https://github.com/leonardocustodio/mkdocs-copy-to-llm/issues/24
- Working features: Copy page, Open in ChatGPT, Open in Claude

## 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
This commit is contained in:
Sanjeed
2025-12-30 15:34:46 +05:30
committed by GitHub
parent cb998ba3b3
commit 36654940fb
3 changed files with 55 additions and 1 deletions
+46 -1
View File
@@ -175,4 +175,49 @@ code, kbd, samp, pre {
margin-top: 1.5rem;
}
/* Let Material Design handle everything else - no custom colors, spacing, or layouts */
/* Let Material Design handle everything else - no custom colors, spacing, or layouts */
/* Copy to LLM button - dark mode styling */
/* Using semantic naming: surface (background), text (foreground), border, hover-overlay */
[data-md-color-scheme="slate"] .copy-to-llm-split-container {
--copy-llm-border: #404040;
--copy-llm-surface: #2d2d2d;
--copy-llm-text: #e0e0e0;
--copy-llm-hover-overlay: rgba(255, 255, 255, 0.1);
border-color: var(--copy-llm-border);
}
[data-md-color-scheme="slate"] .copy-to-llm-section {
background-color: var(--copy-llm-surface) !important;
color: var(--copy-llm-text) !important;
}
[data-md-color-scheme="slate"] .copy-to-llm-left {
border-right-color: var(--copy-llm-border) !important;
}
[data-md-color-scheme="slate"] .copy-to-llm-left:hover,
[data-md-color-scheme="slate"] .copy-to-llm-right:hover,
[data-md-color-scheme="slate"] .copy-to-llm-right.active {
background-color: var(--md-accent-fg-color) !important;
color: #ffffff !important;
}
[data-md-color-scheme="slate"] .copy-to-llm-dropdown {
background-color: var(--copy-llm-surface) !important;
border-color: var(--copy-llm-border) !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
[data-md-color-scheme="slate"] .copy-to-llm-dropdown-item {
color: var(--copy-llm-text) !important;
}
[data-md-color-scheme="slate"] .copy-to-llm-dropdown-item:hover {
background-color: var(--copy-llm-hover-overlay) !important;
}
[data-md-color-scheme="slate"] .copy-to-llm-dropdown-item:active {
background-color: var(--md-accent-fg-color) !important;
color: #ffffff !important;
}
+8
View File
@@ -266,6 +266,14 @@ plugins:
- search
- social:
enabled: !ENV [MKDOCS_CI, true]
- copy-to-llm:
repo_url: "https://raw.githubusercontent.com/vibrantlabsai/ragas/main/docs"
buttons:
copy_page: true
copy_markdown_link: false # Disabled until plugin bug is fixed
view_as_markdown: false # Disabled until plugin bug is fixed
open_in_chatgpt: true
open_in_claude: true
- llmstxt:
markdown_description: |
Ragas is an open-source evaluation framework for LLM applications including RAG pipelines,
+1
View File
@@ -183,6 +183,7 @@ docs = [
"mkdocs-section-index",
"mkdocs-git-committers-plugin-2",
"mkdocs-git-revision-date-localized-plugin",
"mkdocs-copy-to-llm",
"mkdocs-llmstxt", # Requires Python 3.10+, only used in docs CI
]