Skip to content

Fix copy-for-LLM button to preserve markdown#262

Open
mmurrs wants to merge 1 commit intomainfrom
fix/copy-for-llm-button
Open

Fix copy-for-LLM button to preserve markdown#262
mmurrs wants to merge 1 commit intomainfrom
fix/copy-for-llm-button

Conversation

@mmurrs
Copy link
Copy Markdown
Contributor

@mmurrs mmurrs commented Mar 23, 2026

Summary

  • The "Copy for LLM" button was using article.innerText which stripped all formatting — headings, code blocks, links, tables, lists — producing useless plain text
  • Replaced with turndown library for proper HTML-to-markdown conversion
  • Added custom rules for Docusaurus admonitions, fenced code blocks with language annotations, and stripping UI chrome (copy buttons, the LLM button itself)

Test plan

  • Click "Copy for LLM" on a page with code blocks — verify they appear as fenced markdown with language tags
  • Click on a page with headings, links, lists, tables — verify all formatting preserved
  • Click on a page with admonitions (tip/note/warning) — verify they appear as labeled blockquotes
  • Verify the copied text does NOT include "Copy" buttons or "Copy for LLM" button text
  • Paste into an LLM context window and verify it parses correctly

🤖 Generated with Claude Code

The button was using article.innerText which stripped all formatting
(headings, code blocks, links, tables, lists) producing useless plain
text. Replaced with turndown library for proper HTML-to-markdown
conversion with custom rules for Docusaurus admonitions, fenced code
blocks with language tags, and stripping UI chrome.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
eigencloud-docs Ready Ready Preview Mar 23, 2026 7:11pm

Request Review

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.

1 participant