Skip to main content

An MkDocs plugin that adds a 'Copy as Markdown' button to every page for easy sharing with AI assistants

Project description

MkDocs Copy Markdown

An MkDocs plugin that adds a "Copy as Markdown" button to every rendered documentation page, making it easy to copy content for pasting into AI assistants or sharing with others.

Features

  • Adds a customizable "Copy as Markdown" button to every page
  • Works with both modern browsers (using Clipboard API) and legacy browsers (fallback method)
  • Configurable button text and position
  • Visual feedback when copying succeeds or fails
  • No external dependencies beyond MkDocs

Installation

Install the plugin using pip:

pip install mkdocs-copy-markdown

Or install from source:

git clone https://github.com/ndrezn/mkdocs-copy-markdown.git
cd mkdocs-copy-markdown
pip install .

Configuration

Add the plugin to your mkdocs.yml configuration file:

plugins:
  - copy-markdown

Options

You can customize the plugin behavior with these options:

plugins:
  - copy-markdown:
      button_text: "Copy as Markdown"  # Text displayed on the button
      button_position: "top"           # Position: "top" or "bottom"

Configuration Options

  • button_text (default: "Copy as Markdown"): The text displayed on the copy button
  • button_position (default: "top"): Where to place the button relative to page content. Options are:
    • "top": Places the button above the page content
    • "bottom": Places the button below the page content

Usage

Once installed and configured, the plugin will automatically add a copy button to every page in your MkDocs site. Users can click the button to copy the original markdown source of the page to their clipboard.

The button includes visual feedback:

  • ✓ Copied! - Success message in green
  • ✗ Copy failed - Error message in red

Browser Compatibility

The plugin uses the modern Clipboard API when available and falls back to the legacy document.execCommand('copy') method for older browsers, ensuring broad compatibility.

Development

To set up for development:

git clone https://github.com/ndrezn/mkdocs-copy-markdown.git
cd mkdocs-copy-markdown
pip install -e .

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_copy_markdown-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_copy_markdown-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_copy_markdown-0.1.0.tar.gz.

File metadata

  • Download URL: mkdocs_copy_markdown-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mkdocs_copy_markdown-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7b9b68b80b3cbd7ba771f4d90e2835bd56fabc0afa18530dbf7e2b963754d3de
MD5 ff11d9f2a65555db8aa7c4d542d2141d
BLAKE2b-256 f9491c4a7cd002f33b00b940648732f05996555cdd21d15abf02a3be053fa96e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_copy_markdown-0.1.0.tar.gz:

Publisher: publish.yml on ndrezn/mkdocs-copy-markdown

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mkdocs_copy_markdown-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_copy_markdown-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4ae168ecda7fdc5ad7717a608b1629576cca7cbb6a1902661341414d3f48912
MD5 a5c64a199c1c10ecb37d22ffa86629b7
BLAKE2b-256 46875e4e680d8aca3bc82571f515c3c82d62d4fabe155677287079314b0995e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkdocs_copy_markdown-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ndrezn/mkdocs-copy-markdown

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page