Skip to content

Markdown should render titles and headings with <a> tags to allow in-page links #824

@nthmost

Description

@nthmost

Problem

It should be possible to make in-page links so that the app user can click on a title (e.g. within a Table of Contents) to reach the labeled part of the app quickly.

godot63 on the streamlit forum writes:

I would like to write something like:
[Station information](#Station-information)
where in the document there is a ‘# Station information’ title in the same doc. This seems to work on git but does not in my Streamlit app.

Links to look at:

Solution

MVP: The easiest thing is just to give every Markdown title and heading an automatic <a href="#title"> when it is rendered as HTML in React.

Possible enhancement: As an alternate or additional solution, it might be nice for users to have something like st.label("station-info") to create <a href="#station-info"> when the app is rendered. Then you could create in-page links without also needing to write a title or heading to the screen.

Additional context

https://discuss.streamlit.io/t/links-to-same-document-in-md-document/1265

Metadata

Metadata

Assignees

Labels

feature:markdownRelated to Markdown renderingtype:enhancementRequests for feature enhancements or new features

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions