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

Copy button for code #146

Closed
numero-744 opened this issue Nov 16, 2022 · 4 comments · Fixed by #184
Closed

Copy button for code #146

numero-744 opened this issue Nov 16, 2022 · 4 comments · Fixed by #184
Assignees

Comments

@numero-744
Copy link
Collaborator

What do you think about it?

https://sphinx-copybutton.readthedocs.io/en/latest/

@Dolu1990
Copy link
Member

Sure, why not

@numero-744 numero-744 self-assigned this Nov 16, 2022
@numero-744
Copy link
Collaborator Author

numero-744 commented Nov 16, 2022

2022-11-16-212958_589x195_scrot

Hmm does not render as expected XD

Found open issue: executablebooks/sphinx-copybutton#101

@numero-744
Copy link
Collaborator Author

Interesting answer: executablebooks/sphinx-copybutton#101 (comment)

And accurate:

html_context = {
'css_files': [
'_static/theme_overrides.css', # override wide tables in RTD theme
],
}

Suggestions:

    app.add_css_file("theme_overrides.css")

@dlmiles
Copy link
Contributor

dlmiles commented May 31, 2023

Merge PR #178 (I have already applied the fix there because I also found issues with other things not working as I expected, so all the work I had planned could not be completed, like updating to sphinx-rtd-theme=~latest, but I have updated that now as well in #178)

The commit and log message for the fix 86d62c8

Then you can apply the documented method for installation of this plugin and it should just-work(tm).

It was my process of investigating this issue that allowed me to discover the real problem and the cause.

diff --git a/requirements.txt b/requirements.txt
index e200aa6c8..6e281fda0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,3 +2,4 @@ sphinx==5.3.0
 sphinx-rtd-theme==1.2.1
 sphinxcontrib-wavedrom==3.0.4
 sphinx-multiversion @ git+https://github.com/samuel-emrys/sphinx-multiversion.git@cd723351f687c98d32834226ae7b3ec9e63bcba5
+sphinx-copybutton==0.5.2
diff --git a/source/conf.py b/source/conf.py
index 844749d22..3ae0d4c36 100644
--- a/source/conf.py
+++ b/source/conf.py
@@ -45,7 +45,8 @@ extensions = [
     'sphinx.ext.githubpages',
     'sphinxcontrib.wavedrom',
     'sphinx_multiversion',
-    'sphinx.ext.imgconverter'
+    'sphinx.ext.imgconverter',
+    'sphinx_copybutton'
 ]
 
 # Add any paths that contain templates here, relative to this directory.

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

Successfully merging a pull request may close this issue.

3 participants