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 functionality to hide Python prompts #48

Open
f-brinkmann opened this issue Jun 1, 2021 · 5 comments
Open

Add functionality to hide Python prompts #48

f-brinkmann opened this issue Jun 1, 2021 · 5 comments
Labels
wontfix This will not be worked on

Comments

@f-brinkmann
Copy link

It would be great to have the possibility to hide the python prompts >>> from code blocks for easier copy-pasting.

Here's an example in scipy. The >>> button on the top right corner of the code examples removes them:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp1d.html

Copy-pasting code with the >>> visible will add an empty line between each line you see in the example. Doing the same without the >>> visible removes the empty lines.

I found a discussion of this in another theme and might find some time to give it a go. Would you include it in your code?
readthedocs/sphinx_rtd_theme#167

@mgeier
Copy link
Owner

mgeier commented Jun 1, 2021

Sure, I like this feature, but wouldn't it be possible to implement this as a theme-independent separate extension?

The CSS probably wouldn't be perfect for every possible theme, but I guess it could be made to work with at least a few selected themes.

@f-brinkmann
Copy link
Author

To be honest I'd prefer the road of least resistance for now. Since I'm not firm witch CSS and don't want to generate additional work for me in case someone tries the extension and opens issues when it doesn't work for other themes. Would that be ok for you?

@mgeier
Copy link
Owner

mgeier commented Jun 2, 2021

To be honest I'd prefer the road of least resistance for now.

Me too, that's why I'd prefer a separate Sphinx extension.

When I first saw that feature, I was actually surprised that it wasn't a re-usable Sphinx extension.

But if there are technical reasons that speak against that, I'm open to discussions about including it here.

Since I'm not firm witch CSS and don't want to generate additional work for me in case someone tries the extension and opens issues when it doesn't work for other themes.

You don't have any obligations, you can support as many or as few themes as you like, for how long you like.
Even if you only support the insipid theme, I think it's still worth making a separate extension, because then somebody else can take it and apply it to different themes.
But I don't see why it shouldn't automatically work fine for a reasonably large number of existing themes.

Either way, this feature would have to be able to be switched off, in order to not conflict with other extensions like https://github.com/executablebooks/sphinx-copybutton (which BTW has the same problem of not working for all themes).

@f-brinkmann
Copy link
Author

f-brinkmann commented Jun 2, 2021

Ok, I'll try to find time to look into it and update this thread if I make progress :)

@mgeier mgeier added the wontfix This will not be worked on label Jun 4, 2022
@hagenw
Copy link
Contributor

hagenw commented Sep 28, 2022

I have used https://github.com/executablebooks/sphinx-copybutton since a longer time and it works great, see https://audeering.github.io/audeer/api-audeer.html for an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants