St.expander markdown does not work with links

Summary

st.expander does not show links as expected from documentation

Steps to reproduce

Code snippet:

import streamlit as st

with st.expander(label="https://www.google.com/"):
    st.write("No text or url shown")

with st.expander(label="[My Markdown Link]('https://www.google.com/')"):
    st.write("My Markdown Link not being displayed")

with st.expander(label="**My Markdown**"):
    st.write("Regular Bold Text shows")

Expected behavior:

Show the link inside the expander label, using markdown similar to st.markdown("[My Markdown Link](https://www.google.com/)")

Actual behavior:
1

Debug info

  • Streamlit version: 1.17.0
  • Python version: 3.10.9
  • Conda
  • OS version: Mac
  • Browser version: Brave

Link to GitHub issue I created

2 Likes

I can confirm the issue. This is a regression, the code works as expected in this app:

https://samdobson-streamlit-sandbox-app-za85j0.streamlit.app

Which is deployed with Streamlit 1.15.2 at the moment of writing this.

Same issue with checkboxes - based on documentation the label should support links, but it doesn’t - i.e the following line doesn’t show correctly:
link = st.checkbox("this is a [link](https://www.google.com)")

I checked now in https://samdobson-streamlit-sandbox-app-za85j0.streamlit.app/, cannot create a checkbox with a link in its label

That is because the application has been rebooted and now it runs on streamlit 1.17.0.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.