Skip to content

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

Open
petercorke wants to merge 4 commits into
masterfrom
docs/add-copybutton-codeautolink
Open

petercorke wants to merge 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

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.
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.

1 participant