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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b9b68b80b3cbd7ba771f4d90e2835bd56fabc0afa18530dbf7e2b963754d3de
|
|
| MD5 |
ff11d9f2a65555db8aa7c4d542d2141d
|
|
| BLAKE2b-256 |
f9491c4a7cd002f33b00b940648732f05996555cdd21d15abf02a3be053fa96e
|
Provenance
The following attestation bundles were made for mkdocs_copy_markdown-0.1.0.tar.gz:
Publisher:
publish.yml on ndrezn/mkdocs-copy-markdown
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mkdocs_copy_markdown-0.1.0.tar.gz -
Subject digest:
7b9b68b80b3cbd7ba771f4d90e2835bd56fabc0afa18530dbf7e2b963754d3de - Sigstore transparency entry: 224732120
- Sigstore integration time:
-
Permalink:
ndrezn/mkdocs-copy-markdown@00974fcf97bff06b2ffb3605d22603f2bbbcc391 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ndrezn
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@00974fcf97bff06b2ffb3605d22603f2bbbcc391 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mkdocs_copy_markdown-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mkdocs_copy_markdown-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4ae168ecda7fdc5ad7717a608b1629576cca7cbb6a1902661341414d3f48912
|
|
| MD5 |
a5c64a199c1c10ecb37d22ffa86629b7
|
|
| BLAKE2b-256 |
46875e4e680d8aca3bc82571f515c3c82d62d4fabe155677287079314b0995e4
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mkdocs_copy_markdown-0.1.0-py3-none-any.whl -
Subject digest:
c4ae168ecda7fdc5ad7717a608b1629576cca7cbb6a1902661341414d3f48912 - Sigstore transparency entry: 224732129
- Sigstore integration time:
-
Permalink:
ndrezn/mkdocs-copy-markdown@00974fcf97bff06b2ffb3605d22603f2bbbcc391 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ndrezn
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@00974fcf97bff06b2ffb3605d22603f2bbbcc391 -
Trigger Event:
push
-
Statement type: