I’m wondering if there’s any way to support markdown/HTML like syntax in the help argument of inputs (that generates a tooltip on hover).
Use Case:
I have ~100 features in a model split into 10 groups, and I want the user to be able to control how much weight is given to each group. I use this with a number input and ideally include the features that belong in that group in the tooltip of the corresponding input. It’s much more appealing to show a list of 10 features where each feature is on a new line rather than a list of 10 in a row separated by commas. Unfortunately, splitting with ‘\n’ seems to just be ignored.
How possible would this be? Any workarounds? Happy to look into making the changes myself if it’s something feasible.
Is this something only available in newer versions? I’m running 1.11.0 and do not see markdown supported.
Example code:
import streamlit as st
triple_quote = ''' first line
second line'''
st.number_input('test1', help = triple_quote)
new_line = 'first line \n second line'
st.number_input('test2', help = new_line)
This code does not split the help text into two lines.
EDIT: Solved. You have to use 2 spaces after the end of the line, even if using a newline character. (old line \n). I was mistaken that just a new line would suffice. I was able to get my code working using: info = ' \n'.join(x). (two spaces before \n) Thanks for the help @mathcatsand
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.