Disable Code Output In Markdown

Hello,

This is for a locally hosted, personal chatbot project.
Streamlit version: 1.3.0
Python version: 3.10.10

I’m learning/experiementing with using Streamlit for the app. My chatbot is only converstional and will never be outputting any code.

The issue: Every time the chatbot has a tab in it’s output (for example if it’s creating a document outline), that content ends up in a code block.

My question is: Is there a way to remove or disable the code block from the markdown? If not, is there an alternative to handling the tabs in the output without using the unsafe_allow_html=True?

Thanks for any advice!

-Ale

If your chatbot’s output is not markdown, then using st.markdown to display it will lead to issues like this. Maybe use st.text instead?

Thanks for the reply.

I just tried this, but unfortunately st.text is worse. It puts all of the chatbot response content in a horizontally scrollable monospace type font like the code block.

Any other ideas?

-Ale

Unfortunately streamlit provides only limited ability to display raw text out of the box. You can find some suggestions and workarounds in this other thread: