Skip to content

Conversation

@Shrikantgiri25
Copy link

@Shrikantgiri25 Shrikantgiri25 commented Nov 21, 2025

Description

Currently, code blocks in the DRF documentation must be copied manually. This PR introduces a “Copy” button for code blocks to improve usability.

Scope: Docs-only improvement — does not modify DRF library or API.

Implementation:

Files and Purpose:

1. css/copy-button.css – Styles the copy button, positions it inside code blocks, and applies DRF’s red theme color for consistency.

2. js/copy-button.js – Adds a “Copy” button to each <pre><code> block, handles the clipboard copy functionality, and provides user feedback (“Copied!”).
 
3. mkdocs.yml – Registers the CSS and JS files so they are loaded with the documentation.
 
4.  main.html – Ensures the extra CSS is included in the page layout.

Discussion - #9829

Screenshots:
image

image

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