python-jsonschema / jsonschema

An implementation of the JSON Schema specification for Python
https://python-jsonschema.readthedocs.io
MIT License
4.52k stars 574 forks source link

Using the copy button of the code block in the README results in error "zsh: command not found: $" #1246

Closed activus-d closed 3 months ago

activus-d commented 3 months ago

Description

When clicking the copy button from the block code in the README to install jsonschema, the copied text is $ pip install jsonschema. Running the copied command returns a "command not found: $" error. I believe this will be same for all other block codes in the README.

The possible solution is to modify the commands in the README.rst file to exclude the leading $ symbol. For example:

.. code:: bash

    pip install jsonschema
activus-d commented 3 months ago

I can work on this issue if assigned.

Julian commented 3 months ago

Hi there! Thanks for the report. Showing a $ there is pretty common in documentation, it's meant to indicate a shell prompt, and should be understood not to be copied -- it's arguably also good that it's there, as it's good practice not to copy+paste shell commands in the first place!

That all being said though, I've slightly tweaked the settings for sphinx-copybutton which is the plugin we use to show a "copy to clipboard" button in the documentation, so that now at least if you use that, it's not included.

Appreciate the issue nonetheless.