nextstrain / sphinx-theme

A Sphinx theme for Nextstrain's documentation, based on Read The Docs' default theme.
https://docs.nextstrain.org/projects/sphinx-theme/
MIT License
0 stars 5 forks source link

Include sphinx-copybutton with nextstrain-sphinx-theme #26

Closed victorlin closed 2 years ago

victorlin commented 2 years ago

Description of proposed changes

This extension has been recently used in a few of Nextstrain's doc projects:

Adding it to this package will make Nextstrain's doc projects more consistent going forwards.

Note: for this to work properly, this package must be used as an extension in addition to usage as a theme. See eabffdf as an example.

Related issue(s)

Testing

Tested locally, see PR preview.

victorlin commented 2 years ago

@tsibley

If it's not added as an extension, does anything break? Or does the copy button ext simply not get loaded?

Nothing breaks from what I see. The extension just doesn't get loaded.

Can we set some defaults for sphinx_copybutton's settings so that, e.g., the prompt in this .. code-block:: console isn't copied?

Good idea! Done: 2ca2074b024cc0ed09eba16b8fcbf375578b0367

tsibley commented 2 years ago

All of this is making me wish sphinx-copybutton used the same lexers used for highlighting, so that the prompt/continuation char stuff was specific to each code-block and automatic. As it stands, copybutton less robustly re-does at run time the same work as the highlighting does at build time!