Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Click to copy text for commands present in the official Django website. #1276

Open
VenkataBhaskarr opened this issue Nov 23, 2022 · 15 comments · May be fixed by #1434 or #1447
Open

Add Click to copy text for commands present in the official Django website. #1276

VenkataBhaskarr opened this issue Nov 23, 2022 · 15 comments · May be fixed by #1434 or #1447
Labels
good first issue Good for newcomers

Comments

@VenkataBhaskarr
Copy link

As I am following through the Django project tutorial in the official Django website there are so many commands like below, so adding a click to copy text would be a time saver.

Before :

Screenshot 2022-11-23 at 11 32 30 AM

After :

Screenshot 2022-11-23 at 9 30 01 PM

@himanshu007-creator
Copy link

I would like to work on that issue

@carltongibson
Copy link
Member

There's a Sphinx copy button extension: https://sphinx-copybutton.readthedocs.io/en/latest/ — looking into adapting that would be good.

  • What's the HTML it outputs?
  • What's the static file we'd need to include.

The docs aren't raw sphinx HTML. We use the JSON builder, and then insert the body into a Django template.

@VenkataBhaskarr
Copy link
Author

yes if we used Sphinx copy button extension the ouputs are as follows

I have added sphinx_copybutton in extensions in conf.py file in docs folder.

BEFORE :

Screenshot 2022-11-26 at 10 56 32 AM

AFTER :

Screenshot 2022-11-26 at 10 56 24 AM

@Maniktherana
Copy link
Contributor

Maniktherana commented Jan 23, 2023

It seems some code blocks already have this feature (clipboard.js). Perhaps we can just utilize that but I like the style of the Sphinx copy button for 1 line commands.

I'd be willing to work on this if it's still open.

Screenshot 2023-01-23 at 4 08 48 PM

@GitAditya123
Copy link

import django
print(django.get_version())
4.2

@sabderemane sabderemane added the good first issue Good for newcomers label May 24, 2023
@benjaoming
Copy link
Contributor

sphinx-copybutton also uses clipboard.js - so I guess it's a matter of avoiding loading the same JS library twice if its included through the Sphinx extension. If the copy of the JS library included in sphinx-copybutton can be used for the Django project (or the other way around), then we can also avoid having the same asset from different sources and with different versions. But other than that, seems like it's possible to use the same styles, HTML elements and JS library on the entire website, as well as isolated Sphinx documentation builds 👍

@rabahalishah
Copy link

I would like to contribute to this.

@sabderemane
Copy link
Sponsor Member

@rabahalishah feel free to work on this, no need to be assigned to work on an issue :)

@marksweb
Copy link
Contributor

There's a class of code-block-caption which adds the styling and the copy button, but the JS doesn't appear to be loaded by default.

This class and snippet are hooked up to clippify, but they don't appear to be in use anywhere at the moment.

https://github.com/django/djangoproject.com/blob/main/djangoproject/static/js/main.js#L101

@Yadnyesh-Dashpute
Copy link

@VenkataBhaskarr Please Assign Me This Issue. I Want To Work On this Issue.

@marksweb
Copy link
Contributor

@Yadnyesh-Dashpute you don't need to be assigned. People can see now that you will be working on this so go ahead and raise a PR when you have something to look at 👍

@Yadnyesh-Dashpute
Copy link

@marksweb Okay

prashantpandey9 added a commit to prashantpandey9/djangoproject.com that referenced this issue Nov 26, 2023
@Om15102003
Copy link

I would like to work on this issue.

@marksweb
Copy link
Contributor

marksweb commented Dec 6, 2023

@Om15102003 There's already an open PR for this here; #1434

If you find something you'd like to work on, just go ahead and work on it - there's no need to ask. Though it's worth looking to see if anybody has mentioned that they might be working on it or if there are linked PRs. Quite often someone might say they're going to look at something, but unless there's a PR we don't really know the status of that, so bare in mind how long it has been since someone talked about working on something.

prashantpandey9 added a commit to prashantpandey9/djangoproject.com that referenced this issue Dec 6, 2023
nvishnya added a commit to nvishnya/djangoproject.com that referenced this issue Dec 6, 2023
nvishnya added a commit to nvishnya/djangoproject.com that referenced this issue Dec 6, 2023
prashantpandey9 added a commit to prashantpandey9/djangoproject.com that referenced this issue Dec 7, 2023
@Fareed95
Copy link

Hello sir. I'm very new in opensource coding.. but I think I can resolve this problem . but I'm confused from which file is this issue is related to ?? would you please guide me ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet