Skip to content

Strip HTML tags from search entry titles#53

Merged
shenxianpeng merged 1 commit into
mainfrom
fix/search-title-sanitize
Apr 28, 2026
Merged

Strip HTML tags from search entry titles#53
shenxianpeng merged 1 commit into
mainfrom
fix/search-title-sanitize

Conversation

@shenxianpeng
Copy link
Copy Markdown
Member

@shenxianpeng shenxianpeng commented Apr 28, 2026

Sanitize page and section titles in the search index by stripping any HTML tags using the existing _strip_tags utility. This prevents raw HTML from appearing in search results, which is both a UI issue and a potential XSS vector when page titles contain inline HTML from Markdown rendering.

Fixes mkdocs/mkdocs#3560 mkdocs/mkdocs#3213

Related Issue

Fixes #

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)

@github-actions github-actions Bot added the bug Something isn't working label Apr 28, 2026
Sanitize page and section titles in the search index by stripping
any HTML tags using the existing _strip_tags utility. This prevents
raw HTML from appearing in search results, which is both a UI issue
and a potential XSS vector when page titles contain inline HTML
from Markdown rendering.

Fixes #3560
@shenxianpeng shenxianpeng force-pushed the fix/search-title-sanitize branch from a11611f to 13ffc4e Compare April 28, 2026 12:47
@shenxianpeng shenxianpeng merged commit e5a2c9c into main Apr 28, 2026
23 checks passed
@shenxianpeng shenxianpeng deleted the fix/search-title-sanitize branch April 28, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant