You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(widgets): run Pygments via Jinja highlight filter for copybutton parity
Code blocks inside the mcp-install widget now go through Sphinx's
PygmentsBridge via a new ``highlight`` Jinja filter (registered in
BaseWidget.render). Output is byte-identical to Sphinx's native
visit_literal_block, so the theme's highlighting CSS and
sphinx-copybutton's default selector + gp-sphinx's prompt-strip regex
apply automatically — "$ " is tagged ``<span class="gp">`` and dropped
from the copied text.
The widget data renames the CLI language from "shell" to "console"
(ShellSessionLexer) and prepends "$ " to each CLI body; the prereq
``pip install`` block and the client-config JSON now both render
through the same filter path.
Tests gain a HighlightCase NamedTuple + three parametrized tests
(``console-claude-code-uvx``, ``console-pip-prereq``,
``json-mcp-config-uvx``) that build a real ``.. code-block::`` via
SphinxTestApp, extract the rendered block, and assert byte equality
with the widget filter output. Syrupy captures snapshots of the shared
HTML for regression catch. Helpers ported from gp-sphinx's
``tests/_snapshots.py`` as ``tests/docs/_snapshots.py`` with a
Protocol-typed fixture.
0 commit comments