Skip to content

Copy/view docs page as Markdown #145

@thibaudcolas

Description

@thibaudcolas

Summary

Add a feature to copy or view the raw Markdown source of documentation pages directly from the browser, making it easier to extract content for use with LLMs.

Motivation

Users working with LLMs (ChatGPT, Claude, etc.) often want to provide documentation context. Currently, they must:

  1. Click "Edit this page" to go to GitHub
  2. Navigate to the raw file view
  3. Copy the Markdown content

This creates unnecessary friction. A direct "Copy as Markdown" or "View Markdown" button would streamline this workflow.

Use Cases

  • Developers asking LLMs questions about Draftail with full documentation context
  • Creating custom prompts or knowledge bases
  • Extracting content for offline reference
  • Training or fine-tuning scenarios

Example Implementation

GitBook has this feature built-in. See the "Copy" button in the top-right corner of their documentation pages:

https://cityweft.gitbook.io/docs/getting-started/quickstart

This allows users to instantly copy the page content in Markdown format.

Proposed Solutions

Option 1: Copy to Clipboard Button

  • Add a "Copy Markdown" button to the page toolbar (near Edit/GitHub links)
  • Clicking copies the raw Markdown source to clipboard
  • Show brief success toast notification

Option 2: View Markdown Modal

  • Add a "View Markdown" button that opens a modal/dialog
  • Display raw Markdown in a code block
  • Include copy button within the modal

Option 3: Download Button

  • Add a "Download as .md" option
  • Downloads the current page's Markdown file

Implementation Notes

  • Docusaurus may need a custom plugin or theme swizzling
  • Could leverage existing frontmatter/content from build process
  • Consider whether to include or strip frontmatter
  • May need to fetch from GitHub API or bundle Markdown at build time

Acceptance Criteria

  • User can easily access raw Markdown content from any docs page
  • Solution works with versioned documentation
  • Mobile-friendly implementation
  • Clear visual indication of success when copying
  • Performance impact is minimal

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationType: Documentation improvements, additions, or fixesdocusaurusScope: Related to Docusaurus frameworkenhancementNew feature or requestlowPriority: Nice to have, when time permitsmedium effortEffort: 2-8 hours of work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions