Insert markdown into help argument of input parameter

Hi! I’d like to better understand if it’s possible to insert markdown into the help argument of a input widget, or if there’s feasible workarounds. My use case is that I’d like to format the help text with line breaks, and I’ve been unable to find any solutions as of now. Thanks!

What happened when you tried?

The input returns an error for: TypeError: expected string or bytes-like object

I wonder what you are actually trying. Just using markdown syntax in the help text shouldn’t cause that error. There must be something else going on.

help=st.markdown(‘## test’) is what I tried.

The help keyword argument needs to be given a string, not a Streamlit command.

help_txt = '''
# This is a header

This is plain text with some :red[color].
Check out [Streamlit](


st.number_input('label',0,10,0,1, help=help_txt)


:warning: Note that color only works for Streamlit v1.16.0 that was released a few days ago, be sure to update if you want that.

Thank you very much! So the keyword argument only interprets line breaks specified as empty lines opposed to programmatically such as br, \n, etc. ?

Just follow markdown rules for line breaks.

One option is to end lines with two spaces.

There are two spaces at the end of this line.  
And this will render as a second line, even though it is right under the previous.

Thanks for the help, I was able to get the below working!

'  \n'.join(list)

Cool. I was just writing up an explanation of string replacement. Even though you don’t need it, I’ll put it here in case it helps someone later:

import streamlit as st

help_txt = '''This is a line
And this follows a line break'''

bytes_help_txt = bytes(help_txt, 'utf-8')

new_line = '''

mod_help_txt = help_txt.replace(new_line,'  '+new_line)

st.number_input('label',0,10,0,1, help=mod_help_txt)