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

Fixed #34846 -- Added copy button to code snippets on the documentation #18247

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arthurvasconcelos
Copy link
Contributor

@arthurvasconcelos arthurvasconcelos commented Jun 8, 2024

Trac ticket number

Done during Django Conference Europe 2024 sprint 🎉

ticket-34846

Branch description

This solution will use the sphinx framework provided copy-button to copy the whole code. On the original PR(#16342) I found this comment #16342 (comment) which I struggle to understand why this solution would conflict. When checking https://github.com/django/djangoproject.com/blob/main/djangoproject/static/js/mod/clippify.js I found them to be different projects using different frameworks, could some extra context be provided on the possible conflict?

Light:
image
Dark:
I couldn't find how to switch to dark mode.

Checklist

  • This PR targets the main branch.
  • The commit message is written in past tense, mentions the ticket number, and ends with a period.
  • I have checked the "Has patch" ticket flag in the Trac system.
  • I have added or updated relevant tests.
  • I have added or updated relevant docs, including release notes if applicable.
  • I have attached screenshots in both light and dark modes for any UI changes.

Co-authored-by: Alexander Lötvall <[email protected]>
Co-authored-by: Saarthak Maini <[email protected]>
Co-authored-by: Venkata Bhaskar <[email protected]>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Thank you for your contribution 💪

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

@knyghty knyghty requested a review from a team June 8, 2024 13:45
@@ -2,3 +2,4 @@ pyenchant
Sphinx>=4.5.0
sphinxcontrib-spelling
blacken-docs
sphinx-copybutton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Is there a way to achieve this without adding this as a new dependency?

I'm slightly concerned about the maintenance status of the underlying js library. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the response, and yeah most probably there is, I will look into it.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What’s your concern @smithdc1? Anecdotally we’ve been using this same dependency for the Wagtail docs for two years now, haven’t had a problem yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arthurvasconcelos did you see the comment on the last PR that this conflicts with JavaScript in djangoproject.com and perhaps should be solved there rather than adding a dependency here?

Copy link
Sponsor Member

@thibaudcolas thibaudcolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely from an accessibility perspective, I’ve reviewed the sphinx_copybutton implementation and am very happy with how it works.

@bmispelon
Copy link
Member

I've been trying to see how this change would actually look like once deployed to docs.djangoproject.com and it has been more challenging than I had thought (the djangoproject website does not use make html, it's a little more complicated than that).

I hope to be able to get to the bottom of this in the upcoming week, but please ping me if I forget 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants