Skip to content

Restore the contrasting version in the docs title - #157

Merged
timkpaine merged 1 commit into
python-project-templates:mainfrom
Point72:tkp/styled-version-title
Sep 17, 2026
Merged

timkpaine merged 1 commit into
python-project-templates:mainfrom
Point72:tkp/styled-version-title

Conversation

@timkpaine

Copy link
Copy Markdown
Member

Themes reuse html_title for the <title> tag, which is why the styled version span was dropped in 2d69e4a: the markup showed up escaped in browser tabs.

Add HtmlTitle, a str whose html returns the tag-stripped text. Sphinx renders docstitle raw in the theme header but pipes it through |e or |striptags|e for <title>, and both filters go via html, so one value gives markup in the header and plain text in the tab.

html_title itself stays a plain str, since check_confval_types compares type(value) exactly and rejects str subclasses, and a class defined in the generated conf.py cannot be pickled with the build environment. The styled form is injected as context["docstitle"] instead, skipping the search page, which is the one template that interpolates docstitle unfiltered.

Themes reuse html_title for the <title> tag, which is why the styled version
span was dropped in 2d69e4a: the markup showed up escaped in browser tabs.

Add HtmlTitle, a str whose __html__ returns the tag-stripped text. Sphinx
renders docstitle raw in the theme header but pipes it through |e or
|striptags|e for <title>, and both filters go via __html__, so one value gives
markup in the header and plain text in the tab.

html_title itself stays a plain str, since check_confval_types compares
type(value) exactly and rejects str subclasses, and a class defined in the
generated conf.py cannot be pickled with the build environment. The styled
form is injected as context["docstitle"] instead, skipping the search page,
which is the one template that interpolates docstitle unfiltered.
@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.20%. Comparing base (4aa5ce1) to head (a167048).

Files with missing lines Patch % Lines
yardang/utils.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #157      +/-   ##
==========================================
- Coverage   86.22%   86.20%   -0.03%     
==========================================
  Files          16       16              
  Lines        2026     2030       +4     
  Branches      209      209              
==========================================
+ Hits         1747     1750       +3     
- Misses        217      218       +1     
  Partials       62       62              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timkpaine
timkpaine merged commit 55bcda3 into python-project-templates:main Sep 17, 2026
1 of 3 checks passed
@timkpaine
timkpaine deleted the tkp/styled-version-title branch September 17, 2026 14:23
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