Skip to content

Expose page.content_title property for plugin authors#52

Merged
shenxianpeng merged 1 commit into
mainfrom
feature/content-title-property
Apr 28, 2026
Merged

Expose page.content_title property for plugin authors#52
shenxianpeng merged 1 commit into
mainfrom
feature/content-title-property

Conversation

@shenxianpeng
Copy link
Copy Markdown
Member

@shenxianpeng shenxianpeng commented Apr 28, 2026

Add a public content_title property to the Page class that exposes the previously private _title_from_render attribute. This gives plugin authors access to the heading text extracted from the first <h1> tag in the page content, with HTML tags stripped and entities unescaped, without reaching into private API.

Fixes mkdocs/mkdocs#3532

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup
  • CI / build / dependency update
  • Other (describe below)

Checklist

  • New tests added for new behavior (if applicable)
  • Documentation updated (if applicable)
  • Release notes docs/about/release-notes.md updated (if applicable)

Add a public content_title property to the Page class that exposes
the previously private _title_from_render attribute. This gives
plugin authors access to the heading text extracted from the first
<h1> tag in the page content, with HTML tags stripped and entities
unescaped, without reaching into private API.

Fixes #3533
@github-actions github-actions Bot added the enhancement New feature or request label Apr 28, 2026
@shenxianpeng shenxianpeng merged commit 50c080c into main Apr 28, 2026
23 checks passed
@shenxianpeng shenxianpeng deleted the feature/content-title-property branch April 28, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider changing the precedence of title sources

1 participant