[feat] Add markdown support to page titles in st.Page#14010
[feat] Add markdown support to page titles in st.Page#14010lukasmasuch merged 3 commits intodevelopfrom
st.Page#14010Conversation
Enable GitHub-flavored Markdown rendering in page titles for `st.Page`. Supported elements include bold, italics, strikethroughs, inline code, Material icons, and images.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
There was a problem hiding this comment.
Pull request overview
This PR adds GitHub-flavored Markdown support to page titles in st.Page, enabling users to format navigation labels with bold, italics, strikethroughs, inline code, Material icons, and images. The implementation integrates the existing StreamlitMarkdown component into navigation links with appropriate restrictions (disabling nested links, truncating overflow) while maintaining accessibility and consistent visual styling.
Changes:
- Added markdown rendering support to page titles via
StreamlitMarkdowncomponent in navigation links - Updated Python docstrings to document the supported markdown elements
- Added line-height override in navigation styles to maintain consistent nav item height with markdown content
- Added tests to verify markdown formatting works correctly in page titles
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
lib/streamlit/navigation/page.py |
Updated docstrings for Page(), StreamlitPage.title, and title property to document markdown support and list supported elements |
frontend/app/src/components/Navigation/SidebarNavLink.tsx |
Replaced plain text rendering with StreamlitMarkdown component, configuring it with appropriate props (isLabel, boldLabel, disableLinks, truncate) |
frontend/app/src/components/Navigation/styled-components.ts |
Added CSS override to maintain consistent line height for nav items when markdown is truncated |
frontend/app/src/components/Navigation/SidebarNavLink.test.tsx |
Added unit test verifying bold and italic markdown renders correctly in page titles |
e2e_playwright/multipage_apps_v2/mpa_v2_basics_test.py |
Added E2E test verifying bold, italic, and inline code formatting in navigation |
e2e_playwright/multipage_apps_v2/mpa_v2_basics.py |
Updated test app to use markdown in page titles for testing purposes |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
## Describe your changes Automated snapshot updates for #14010 created via the snapshot autofix CI workflow. This workflow was triggered by adding the `update-snapshots` label to a PR after Playwright E2E tests failed with snapshot mismatches. **Updated snapshots:** 39 file(s)⚠️ **Please review the snapshot changes carefully** - they could mask visual bugs if accepted blindly. This PR targets a feature branch and can be merged without review approval. Co-authored-by: Streamlit Bot <[email protected]>
SummaryThis PR adds GitHub-flavored Markdown rendering support to page titles in Key changes:
Code QualityThe code is clean and well-structured. The implementation follows existing patterns established by The prop choices are well-considered:
Minor concern — Test CoverageFrontend unit test ( E2E test ( Suggestions for improved test coverage:
Backwards CompatibilityThis change is mostly backwards compatible but has a potential edge case. Existing page titles without markdown syntax will render identically. However, titles containing characters that are markdown syntax (e.g., This behavior is consistent with how other Streamlit label-supporting components work (e.g., Security & Risk
Accessibility
Recommendations
VerdictAPPROVED: A clean, well-implemented feature that adds markdown rendering to page titles following established patterns from This is an automated AI review by |
Describe your changes
st.Pagestrikethroughs,inline code, Material icons, and imagesst.PagedocstringsGithub Issues
st.Page#11771Testing Plan
SidebarNavLink.test.tsxtest_page_titles_support_markdownto verify bold, italic, and code renderingContribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.