Git Product home page Git Product logo

Comments (4)

choldgraf avatar choldgraf commented on July 17, 2024

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.

mgeier avatar mgeier commented on July 17, 2024

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.

choldgraf avatar choldgraf commented on July 17, 2024

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.

mgeier avatar mgeier commented on July 17, 2024

I like the idea of making it opt-in for now!

from sphinx-copybutton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.