Markdown table now indenting

Summary

I’m trying to create a table using st.markdown(). Since the name and number of columns lead to the table being too wide, I’m trying to name some columns in 2 lines.
So instead of naming a column like this:
this is a really long name of a column
I would name it like this:
this is a really long
name of a column

Steps to reproduce

Code snippet:

st.markdown("""
| Net Profit  | Percent Profitable | Expectancy | Column 3<br>(line 1)<br>(line 2) | Rate of Return <br>(Annualized) |
| :------------ | :--------------- | :---------------| :---------------| :---------------|
| Value | Value | Value | Value | Value
| Value | Value | Value | Value | Value 
""")

Actual behavior:

https://imgur.com/a/aWyj1S1

Debug info

  • Streamlit version: 1.20.0
  • Python version: 3.10
  • OS version: Windows 10
  • Browser version: Chrome

Just add unsafe_allow_html=True to the end of st.markdown to make it render the <br>s properly

Thanks a lot @blackary . you are being super helpful

1 Like

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