Google Material Symbols (rounded style), using the syntax
:material/icon_name:, where "icon_name" is the name of the
icon in snake case. For a complete list of icons, see Google's
Material Symbols
font library.
LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
must be on their own lines). Supported LaTeX functions are listed
at https://katex.org/docs/supported.html.
Colored text and background colors for text, using the syntax
:color[text to be colored] and :color-background[text to be colored],
respectively. color must be replaced with any of the following
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
For example, you can use :orange[your text here] or
:blue-background[your text here].
unsafe_allow_html(bool)
Whether to render HTML within body. If this is False
(default), any HTML tags found in body will be escaped and
therefore treated as raw text. If this is True, any HTML
expressions within body will be rendered.
Adding custom HTML to your app impacts safety, styling, and
maintainability.
Note
If you only want to insert HTML or CSS without Markdown text,
we recommend using st.html instead.
help(str)
An optional tooltip that gets displayed next to the Markdown.
Examples
Python
import streamlit as st
st.markdown("*Streamlit* is **really** ***cool***.")
st.markdown('''
:red[Streamlit] :orange[can] :green[write] :blue[text] :violet[in]
:gray[pretty] :rainbow[colors] and :blue-background[highlight] text.''')
st.markdown("Here's a bouquet —\
:tulip::cherry_blossom::rose::hibiscus::sunflower::blossom:")
multi ='''If you end a line with two spaces,
a soft return is used for the next line.
Two (or more) newline characters in a row will result in a hard return.
'''
st.markdown(multi)
import streamlit as st
md = st.text_area('Type in your markdown string (without outer quotes)',"Happy Streamlit-ing! :balloon:")
st.code(f"""
import streamlit as st
st.markdown('''{md}''')
""")
st.markdown(md)