-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 functionality to hide Python prompts #167
Comments
I have copybutton.js in def setup(app):
app.add_javascript('copybutton.js') I was hoping that this would provide the feature without needing to change the sphinx_rtd_theme. However, although it works with other themes, it doesn't with this one. |
I found that, in order to get |
Thanks @matthew-brett, your solution works for me too. |
This hasn't been discussed since 2015 apparently; however, this is the only discussion of this issue I can really find on the web. I figured I should add my experience to the mix. The
In my HTML, the code block are class
and the |
To add to @notmatthancock's comment, in my case the div class was So my code looks like:
|
And I'm just going to add that I also had to extend the |
For anyone looking for this functionality as an installable extension I've created sphinx toggleprompt https://github.com/jurasofish/sphinx-toggleprompt doesn't currently cover all the div classes you guys have mentioned but they're trivial to add (will create an issue and get around to it sometime). |
I very much like the possibility to hide
>>>
prompts in the new SciPy documentation. Here is an example of what I mean:http://docs.scipy.org/doc/numpy/user/misc.html#examples
This way, you could easily paste code into interactive sessions.
But I also like the rtd theme! It would be quite easy to incorporate this functionality. You would just have to copy the copybutton.js file to the
sphinx_rtd_theme/static/js
directory.Then you need to add the following line after line 143 of theme.html:
Thanks for considering the request! If you prefer, I could also set up a PR.
The text was updated successfully, but these errors were encountered: