Hi @dataprofessor, thanks but I am getting this from an online chat API or from user input. I guess I can go through and cleanup the input but I was hoping there was a way to disable certain format rendering within the text method. Or to use a better font and word wrap for st.text.
Can you? You would have to deal with all Markdown syntax: square brackets for links, number symbols # for headers, pipes and dashes for tables, asterisks and (again) dashes for lists, numbers for numbered lists, allowed HTML tags (is there a list of them somewhere?), colons for emoji and colors…
st.text doesn’t do any formatting, it assumes the text is already formatted and displays it as is. For a better font I guess you can use CSS, but I would argue that for preformatted text monospaced fonts are better. For text wrapping use textwrap.
Thanks, I was starting to think that might become a bigger challenge than I expected… not always sure what content will be delivered from the api. Thanks for the tip on textwrap. Might get challenging since I am targeting desktop and mobile.
Thx for the response.
Unfortunately passing the rawstring with fR does not resolve the problem.
What is really strange for me is, that after the warning code and or comments are displayed in the terminal.
I noticed that it only happens when I have 2 $ signs in a f string
As soon as I add the next $ sign in my f string I get the weird formatting and need to escape every $ with the backslash.
This should really get fixed because it’s making chat output from GPT and other LLMs look buggy. It’s not a markdown standard to format with $, so why does Streamlit do it?
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.