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

docs(dev): add copy button for code blocks #15746

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

Conversation

miketheman
Copy link
Member

To make it easier to copy code from the docs and paste into a terminal, add sphinx-copybutton which Furo theme already supports. Refs: https://pypi.org/project/sphinx-copybutton/

Remove leading $ signs for commands, since they should not be copied.

@miketheman miketheman requested a review from a team as a code owner April 10, 2024 14:05
Comment on lines +30 to +32
git checkout -b update_dev_db_dump
git add dev/example.sql.xz
git commit -m "Update development database dump"
Copy link
Member

Choose a reason for hiding this comment

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

These multi-line command blocks don't really copy correctly, we might want to break them into separate blocks instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you explain what you mean? I tested the copy button, and my clipboard contents have:

git checkout -b update_dev_db_dump
git add dev/example.sql.xz
git commit -m "Update development database dump"

Copy link
Member

Choose a reason for hiding this comment

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

Since copy/pasting this into a terminal would result in the first two lines immediately being executed due to the newlines, I would expect this to either be:

git checkout -b update_dev_db_dump
git add dev/example.sql.xz
git commit -m "Update development database dump"

or:

git checkout -b update_dev_db_dump; \
git add dev/example.sql.xz; \
git commit -m "Update development database dump"

Copy link
Member

Choose a reason for hiding this comment

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

(fwiw, I think I prefer the former)

To make it easier to copy code from the docs and paste into a terminal,
add `sphinx-copybutton` which Furo theme already supports.
Refs: https://pypi.org/project/sphinx-copybutton/

Remove leading `$` signs for commands, since they should not be copied.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants