How to use our html formatting code like __bold__ and - bullet in st.text_area

Hello guys,
I just want to put formatting html codes like bold, italic, bullets in st.text_area. then if I click the submit button that text area message should be deliver in slack channel with bold, italics whatever I mentioned in that text_area along with text.

Hi @sanjeevicenas, welcome to the forum!

Actually, that you’re doing is fine! If you put what you’ve typed in without any quotes around it, you can expect it to show up as properly formatted wherever you send it – as long as wherever you send it support adding formatting to markdown.

To show that this works, you can take the output of the text_area and pass it into st.markdown, and it should be formatted properly.

For example:

import streamlit as st

md = st.text_area("Put markdown here")


this is my code i tried that method but when i click that send button that message will not delivered as we expected output in my slack channel.

The text_area widget just returns text. Anything special that you want to do with that text depends on you, and on the library you’re using. In this case, understanding what send_slack_message does with the text you pass in is probably the key. Is it expecting plain text with markdown for formatting?

Are you using this method? chat.postMessage method | Slack

In general, here are some steps for debugging the issue:

  • Use st.code to print out the value of slack_message instead of sending it to Slack. Does it look exactly the way you expect?
  • Use st.markdown to print out the code and see if it’s formatted the way you expect.
  • Try calling send_slack_message in ipython, and see if it sends the message formatted the way you expect.

Hopefully those steps will help isolate the isolate the problem.

Thank you @blackary. it’s worked.