Skip to content

docs: add sphinx-copybutton and sphinx-codeautolink - #223

Merged
taughz merged 4 commits into
masterfrom
docs/add-copybutton-codeautolink
Oct 16, 2026
Merged

taughz merged 4 commits into
masterfrom
docs/add-copybutton-codeautolink

Conversation

@petercorke

Copy link
Copy Markdown
Collaborator

Summary

Brings SMTB's docs config in line with RTB and MVTB, which both already have these two extensions:

  • sphinx-copybutton: adds a copy button to code blocks, stripping interactive >>> /... /$ prompts so copied code actually runs.
  • sphinx-codeautolink: turns code identifiers in examples into links to their API docs.

Config (extensions list, suppress_warnings for codeautolink's own match warnings, copybutton_prompt_text/etc., codeautolink_custom_blocks/codeautolink_search_css_classes) mirrors RTB's conf.py exactly.

Also fixes a small pre-existing formatting wart in intro.rst: two .. code-block:: python blocks had :linenos: indented 3 spaces against 4-space code content. Plain docutils tolerated this silently, but sphinx-codeautolink's own parsing pass over code blocks is stricter and surfaced it as a new "unexpected indent" warning -- fixed rather than left as a regression.

Test plan

  • Real sphinx-build -b html, isolated venv, against both master and this branch
  • Warning count identical before/after: 14 warnings both times, same content

@taughz taughz mentioned this pull request Oct 11, 2026
17 of 19 tasks
sphinx-codeautolink's own parsing pass over code blocks is stricter
than plain docutils about this pre-existing 3-space/4-space mismatch
between the :linenos: option and the code content, surfacing a new
'unexpected indent' warning that was previously silently tolerated.
@taughz
taughz force-pushed the docs/add-copybutton-codeautolink branch from 563de34 to 7175a4a Compare October 16, 2026 13:29
@taughz
taughz merged commit 8369197 into master Oct 16, 2026
13 checks passed
@taughz
taughz deleted the docs/add-copybutton-codeautolink branch October 16, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants