Skip to content

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

@mosc9575

Description

@mosc9575

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]: ', ' ...: ', ' .....: '

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions