Git Product home page Git Product logo

Comments (9)

choldgraf avatar choldgraf commented on September 18, 2024

My intuition is that yes, we should copy them because the user is going to expect the output to look almost just like the copied code (minus prompts)

from sphinx-copybutton.

chrisjsewell avatar chrisjsewell commented on September 18, 2024

Also I can't figure this out, but in this repository I used:

copybutton_prompt_text = ">>> |\\\\$ |\\[\\d*\\]: |\\.\\.\\.: "

which appears to work fine.
but in aiida I've had to use:

copybutton_prompt_text = '>>> |\\\\$ |In \\\\[\\\\d\\\\]: |\\\\s+\\.\\.\\.: '

with the tonnes of backslashes, but this is what works

from sphinx-copybutton.

chrisjsewell avatar chrisjsewell commented on September 18, 2024

See: https://325-77234579-gh.circle-artifacts.com/0/html/intro/tutorial.html

from sphinx-copybutton.

choldgraf avatar choldgraf commented on September 18, 2024

god I hate regexes 😆

from sphinx-copybutton.

amotl avatar amotl commented on September 18, 2024

Dear Chris,

first things first: Thanks for your excellent work on this Sphinx addon, it really saves us.

We want to report back about what @chrisjsewell originally reported here. Apparently, we are getting tripped by this as well. For example, the code block at [1] will not get copied "as-is", all empty lines are missing. The config entries within conf.py we are currently using can be reviewed at [2].

Are we missing any respective configuration option here? Otherwise, do you see an easy way to make sphinx-copybutton pass through empty lines?

With kind regards,
Andreas.

[1] https://crate.io/docs/python/en/latest/sqlalchemy.html#tables
[2] https://github.com/crate/crate-docs-theme/blob/0.15.1/src/crate/theme/rtd/conf/__init__.py#L112-L115

from sphinx-copybutton.

choldgraf avatar choldgraf commented on September 18, 2024

I'm not quite sure where the fix needs to be for this unfortunately, and haven't had time to dig into the code to figure it out. If you or anybody else wants to take a look I am happy to review PRs! (maybe @sappelhoff has run into this issue too?)

from sphinx-copybutton.

amotl avatar amotl commented on September 18, 2024

Thank you for the quick response. I tried to find the spot and handed in a corresponding patch with #127, and, optionally #128.

from sphinx-copybutton.

sappelhoff avatar sappelhoff commented on September 18, 2024

(maybe @sappelhoff has run into this issue too?)

I haven't (yet), but I am glad that @amotl prepared a patch (and I would vote for making copying empty lines the default)

from sphinx-copybutton.

amotl avatar amotl commented on September 18, 2024

Thank you Stefan, appreciate it. Both bringing in the feature as well as making copying empty lines the default behavior have now been folded into #127.

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.