Opened 15 months ago
Last modified 6 months ago
#34846 assigned Cleanup/optimization
Add "Copy" button to the code snippets in docs.
Reported by: | rushabhTt | Owned by: | Mubeen F. |
---|---|---|---|
Component: | Documentation | Version: | 4.2 |
Severity: | Normal | Keywords: | |
Cc: | Arthur Vasconcelos | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Dear Django Team,
I'd like to suggest an enhancement for your website. Adding a "copy" button to the code blocks could significantly improve user experience. This feature would allow users to easily copy code snippets, saving them from manually selecting and copying, especially for larger blocks.
A small icon in the top right corner of each code block could serve as this "copy" button. Upon clicking, it would copy the entire block of code to the user's clipboard.
This feature is common on many programming and documentation websites and could be a valuable addition to yours.
Thank you for considering this suggestion.
Best,
hehe
Attachments (1)
Change History (13)
comment:1 by , 15 months ago
comment:2 by , 15 months ago
Possible duplicate of #18721 though that ticket contained 3 separate feature requests.
I'd vote +1 on this, though we may need a forum post to review the options. The plugin suggested in the above PR seems nice because it handles pycon
snippets removing prompts & output.
comment:3 by , 15 months ago
Component: | Uncategorized → Documentation |
---|
comment:4 by , 15 months ago
I would also +1. I think the request is reasonable and can see how this would be a nice experience when going through the tutorials
by , 15 months ago
Attachment: | Screenshot_20230918_105141.png added |
---|
comment:6 by , 15 months ago
Summary: | "Enhancing User Experience: The Need for a 'Copy' Button in Django Website Code Blocks" → Add "Copy" button to the code snippets in docs. |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | New feature → Cleanup/optimization |
Sounds good, if there is a reasonable Sphinx plugin.
#18721 was a multi-task ticket so I'd leave it closed.
comment:7 by , 15 months ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
I have created a Pull Request for this ticket.
Pull Request : https://github.com/django/django/pull/17292
I referenced the pull request ( https://github.com/django/django/pull/16342/ ) mentioned above in the discussion.
I tested it and found that it was only working for text which was starting with "$ " and not covering text starting with "...\>".
So, I used the regex to resolve the issue and made the copy functionality available for both Linux/MacOS Option and Windows Option
comment:8 by , 15 months ago
Yeah look I think we should give the original author a chance here instead of just taking over what they did... I mean they're probably patiently waiting for someone to review it. They haven't actually said that they can't continue.
comment:9 by , 15 months ago
Owner: | changed from | to
---|---|
Patch needs improvement: | set |
comment:10 by , 10 months ago
Owner: | changed from | to
---|
comment:11 by , 6 months ago
Cc: | added |
---|---|
Patch needs improvement: | unset |
comment:12 by , 6 months ago
Patch needs improvement: | set |
---|
Investigation is required as to whether this shouldn't be solved in djangoproject.com as is the current approach
Just a note that I saw a PR for this https://github.com/django/django/pull/16342/