diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ec2ef10..07b2735 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,16 @@ Changelog ========= +`2025.5 `_ +--------------------------------------------------------------------------- + +* Make the copy button only appear when hovered over or clicked on by @kevteg in https://github.com/python/python-docs-theme/pull/243 + +`2025.4.1 `_ +------------------------------------------------------------------------------- + +* Fix copy button with multiple tracebacks by @tomasr8 in https://github.com/python/python-docs-theme/pull/240 + `2025.4 `_ --------------------------------------------------------------------------- diff --git a/python_docs_theme/__init__.py b/python_docs_theme/__init__.py index e4d06be..2336dc1 100644 --- a/python_docs_theme/__init__.py +++ b/python_docs_theme/__init__.py @@ -7,7 +7,7 @@ from sphinx.application import Sphinx from sphinx.util.typing import ExtensionMetadata -__version__ = "2025.4" +__version__ = "2025.5" THEME_PATH = Path(__file__).resolve().parent diff --git a/python_docs_theme/static/copybutton.js b/python_docs_theme/static/copybutton.js index 9df468e..de071f4 100644 --- a/python_docs_theme/static/copybutton.js +++ b/python_docs_theme/static/copybutton.js @@ -8,7 +8,7 @@ function getCopyableText(rootElement) { for (const el of tracebacks) { while ( el.nextSibling && - (el.nextSibling.nodeType !== Node.DOCUMENT_NODE || + (el.nextSibling.nodeType !== Node.ELEMENT_NODE || !el.nextSibling.matches(".gp, .go")) ) { el.nextSibling.remove() diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index 6d50092..4873116 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -451,6 +451,7 @@ div.genindex-jumpbox a { color: #000; background-color: #fff; border: 1px solid #ac9; /* follows div.body pre */ + display: none; } .copybutton:hover { @@ -461,6 +462,14 @@ div.genindex-jumpbox a { background-color: #ddd; } +.highlight:active .copybutton { + display: block; +} + +.highlight:hover .copybutton { + display: block; +} + @media (max-width: 1023px) { /* Body layout */ div.body {