Comments (4)
Thanks for the feedback - some quick thoughts:
The option copybutton_skip_text seems to expect a single line of text (by default '>>> '). However the Python prompt can also have another form, namely '... '.
That's a good point, I believe that it was also suggested in https://github.com/choldgraf/sphinx-copybutton/issues/52#issuecomment-574272086
Also, if the prompt is ignored, shouldn't the outputs be ignored as well?
agree to make this configurable (also in https://github.com/choldgraf/sphinx-copybutton/issues/52#issuecomment-574272086 I believe)
https://github.com/choldgraf/sphinx-copybutton/issues/52
For your final example - to clarify, you are asking about the situation where a user wants both to skip python prompts in the copying, but also to include other lines that do have the same text (e.g. >>>
) but that should be copied because they're not actually Python prompts. Is that right?
from sphinx-copybutton.
For your final example - to clarify, you are asking about the situation where a user wants both to skip python prompts in the copying, but also to include other lines that do have the same text (e.g.
>>>
) but that should be copied because they're not actually Python prompts. Is that right?
No, I'm talking about the case where a user is blissfully unaware of the "skipping" feature and uses something like an e-mail conversation in a code
block and is surprised why suddenly some of the >
markers are missing in the copied text.
If I understood correctly, the current implementation doesn't take the language of the code block into concern, right?
I think it's not good to willy-nilly remove arbitrary strings of characters from arbitrary text.
I think something like the thing from the Python docs makes mores sense, since it seems to take the syntax highlighting into account.
IOW, I think it would probably make more sense to have the "skipping" feature only in syntax-highlighted code.
from sphinx-copybutton.
Hmmm - it's a fair point that we want to avoid unexpected behavior. I think that long-term, it might be best to implement some kind of behavior that depends on code cell type. In the short term, I'll set the default behavior to "don't auto-remove any prompts" so that users have to explicitly set it if they want the behavior. I feel like this is more in-line with "explicit is better than implicit". If people bring up that they're having issues because they need some cells to keep the prompt text, while others they want to strip it, then we can put more cycles into a more sophisticated setup
from sphinx-copybutton.
I like the idea of making it opt-in for now!
from sphinx-copybutton.
Related Issues (20)
- Convert documentation into MyST Markdown
- Update the copybutton image to match GitHub's copybutton style
- Modularize our documentation a bit HOT 1
- Copy button stays put sometimes when other objects shrink its container
- Copy button does not show up for productionlist HOT 1
- issue to store media HOT 1
- Post message after all copy buttons added HOT 3
- Build failed for config doc when importing an extension sphinx_copybutton HOT 4
- Failed build in RTD for extension sphinx-copybutton
- Copybutton disappears too quickly if you click copy then move the cursor off the code cell
- Conflict between regex exclusion/prompt selection and copybutton_exclude HOT 12
- Add Trailing New Line to Clipboard Option HOT 1
- Blank Lines Stripped from code
- Use only one tooltip HOT 2
- newline ignored when using emphasize-lines HOT 1
- Copy button not shown on some pages HOT 3
- Example Not Functional HOT 2
- Add expand button for some block elements HOT 1
- Stripping ellipsis HOT 1
- URL to copy-button.svg is incorrect because DOCUMENTATION_OPTIONS.URL_ROOT is undefined HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sphinx-copybutton.