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
{{ message }}
Repository navigation
Modernize pydoc's HTML output to match the docs.python.org style #153906
Modernize the HTML generated by pydoc — the pydoc -b/-p server pages and pydoc -w files — by replacing the remaining 1990s-era markup with semantic HTML5 and restyling the pages after the python-docs-theme used by docs.python.org.
This is the unfinished half of gh-54925 (bpo-10716). The first half landed in 3.11 (GH-28651): HTML5 doctype, <font>/bgcolor removed, colors moved to pydoc_data/_pydoc.css. But the markup is still built of layout tables, docstrings are encoded with and <br>, anchors use the obsolete <a name=...>, and the visual design is unchanged ("big coloured rectangles").
Proposed changes
Markup (pydoc.HTMLDoc and the server pages):
<header>/<section>/<h1>–<h4> instead of layout tables; a flexbox <nav> for the server's navigation bar;
multi-column lists via CSS columns (responsive, instead of fixed 4 columns);
docstrings rendered with white-space: pre-wrap instead of /<br>;
ServerHTMLDoc in xmlrpc.server, which reuses HTMLDoc, is updated to match.
Style sheet (pydoc_data/_pydoc.css, still separate and user-customizable):
fonts, colors and link styles from the python-docs-theme;
topic/keyword pages render the help text as docs.python.org-style literal blocks;
dark mode via prefers-color-scheme;
:target highlighting for anchors.
Compatibility:HTMLDoc is undocumented but subclassed in the wild, so all method signatures are kept; parameters that no longer make sense are accepted and ignored. Server page titles are unchanged. The markup itself does change, so code scraping the generated HTML needs adjusting.
Note: pydoc -w files referencing no style sheet at all is a separate bug (gh-127276) with an independent fix.
Activity
gh-153906: Modernize pydoc HTML output (GH-153909)
hugovk commentedon Jul 19, 2026
I also opened #154132.
gh-153906: Show 'Data' in code formatting (#154132)