django / djangoproject.com

Source code to djangoproject.com
https://www.djangoproject.com/
BSD 3-Clause "New" or "Revised" License
1.86k stars 938 forks source link

Fixed #1276 -- Added copy buttons to console and shell commands. #1447

Open nvishnya opened 7 months ago

nvishnya commented 7 months ago

Fixes #1276

Although there is a PR pending, added one as well, hope it's okay.

Added copy buttons for console and shell commands. Also added copy buttons on the Download page. Minimum code changes, no new styles added, button adding functionality is moved to a separate function, so it can be further reused with different code blocks.

test

Comments aren't copied (like in an example below), nor are the promts. 12023-12-06_21-30

nvishnya commented 3 weeks ago

I saw @prashantpandey9's PR, but decided to start the contribution from scratch. I think it's better not to modify existing styles but to reuse them where necessary.