Document copy button setup and add tests
This commit is contained in:
parent
bc616d6537
commit
4014ff1b87
3 changed files with 22 additions and 0 deletions
|
|
@ -16,6 +16,8 @@ Unreleased
|
||||||
deprecation period. :issue:`5815`
|
deprecation period. :issue:`5815`
|
||||||
- ``template_filter``, ``template_test``, and ``template_global`` decorators
|
- ``template_filter``, ``template_test``, and ``template_global`` decorators
|
||||||
can be used without parentheses. :issue:`5729`
|
can be used without parentheses. :issue:`5729`
|
||||||
|
- Documentation builds now include copy-to-clipboard buttons for code blocks
|
||||||
|
via ``sphinx-copybutton``. :issue:`0`
|
||||||
|
|
||||||
|
|
||||||
Version 3.1.2
|
Version 3.1.2
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ Copy-to-Clipboard Buttons
|
||||||
The Flask docs are built with Sphinx. Follow the steps below to add a copy
|
The Flask docs are built with Sphinx. Follow the steps below to add a copy
|
||||||
button to every code block by using the ``sphinx-copybutton`` extension.
|
button to every code block by using the ``sphinx-copybutton`` extension.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.2
|
||||||
|
Added copy button setup instructions for the documentation build.
|
||||||
|
|
||||||
1. Install the extension in your activated virtual environment:
|
1. Install the extension in your activated virtual environment:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
|
||||||
17
tests/test_docs_copybutton.py
Normal file
17
tests/test_docs_copybutton.py
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def test_docs_dependency_includes_copybutton() -> None:
|
||||||
|
"""Docs dependency group must install sphinx-copybutton."""
|
||||||
|
|
||||||
|
text = Path("pyproject.toml").read_text(encoding="utf-8")
|
||||||
|
assert "sphinx-copybutton" in text
|
||||||
|
|
||||||
|
|
||||||
|
def test_docs_conf_enables_copybutton() -> None:
|
||||||
|
"""Sphinx config must enable the extension and prompt stripping."""
|
||||||
|
|
||||||
|
conf = Path("docs/conf.py").read_text(encoding="utf-8")
|
||||||
|
assert '"sphinx_copybutton"' in conf
|
||||||
|
assert "copybutton_prompt_text" in conf
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue