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

Default regular expression for the copy button fails for double digit ipython cells #217

Open
mosc9575 opened this issue Jul 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@mosc9575
Copy link

mosc9575 commented Jul 22, 2024

Context

If ipython is used to run the code examples in the documentation and there are more than 9 cells, the regular expression suggested in using regexp prompt identifiers does not match the continuation and as a result does not copy the complete examples.

See the issue pydata/xarray#9263 for an GitHub issue and https://docs.xarray.dev/en/stable/user-guide/io.html#hdf5 for a failing example.

Proposal

I suggest to update the section using regexp prompt identifiers in the docs.

The regular expression could be

copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.{3,}: | {5,8}: "
copybutton_prompt_is_regexp = True

which would also match the continuation

Prompt Name RegEx Pattern Matched String Examples
ipython and qtconsole + continuation In \[\d*\]: {2,5}\.{3,}: 'In []: ', 'In [999]: ', ' ...: ', ' .....: '
@mosc9575 mosc9575 added the enhancement New feature or request label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant