Full markdown support in Chat for bots

AI-generated summary

The discussion centers on implementing full markdown support in Discourse Chat, specifically focusing on the rendering of headers. 37Rb initially requested this feature, noting that while human users rarely type headers, LLMs and RAG-enabled bots often include them when replying with raw post content. This results in broken formatting for users. Jagster highlighted the annoyance of broken headers, particularly when chat messages are quoted into topics.

Sam acknowledged the issue, and j.jaffeux announced that headings are now supported in chat via a recent commit. When asked if this applies to quoted messages, j.jaffeux confirmed it would work. However, following further consideration, j.jaffeux clarified that heading support is limited to messages generated by bots (user ID < 0). 37Rb inquired about the reasoning, and j.jaffeux explained that human usage had been abused in tests, and platforms like Slack do not support it, leading the team to view more cons than pros for general implementation.

Sam proposed closing the topic as completed, renaming it to “Full markdown support in Chat for bots” to reflect the original scope. 37Rb agreed, stating no general use case was needed. Sam noted that other markdown features, such as MathJax for mathematics, remain complex challenges. Finally, rokejulianlockhart asked if a separate topic exists for general markdown support, noting that until full Discourse Markdown is supported, the feature is insufficient for their needs.

It would be nice if the Chat window had full markdown support. Currently, it appears to intentionally not render markdown headers, as discussed here.

I agree that most people would not type markdown headers in a chat but LLMs might. As chatbots are becoming more common, it would be nice if any markdown sent by an LLM displayed correctly in the Chat window.

With RAG support bots in particular, the LLM receives raw post content from topics which may contain markdown headers. If it includes those headers in the chat reply, they don’t work as is.

4 Likes

My users are using AI mostly in chats (both DAI and Chatbot) and broken headers are a bit annoying. For me, ordinary users just don’t care :smirking_face:

But what bugs me the most is when I copy those chat messages to a topic those quoted headers stay broken.

5 Likes

We hear you and are thinking about this problem.

3 Likes

We now support headings in chat:

https://github.com/discourse/discourse/commit/279fc846db1057dc9e3ee1674e3d909db1ee814a

5 Likes

Including ones that are copied/quoted to topics?

1 Like

Yes it will work

3 Likes

After more consideration, headings will now be limited to messages done by bots (id < 0):

https://github.com/discourse/discourse/commit/5010fced92438d9bb3f19aa7d15f1e5f670a26ac

Why? Is there a normal chat situation where people begin the line with # for another purpose? Just curious.

1 Like

In our rapid tests it’s been abused by people. Also platforms like slack don’t support it. For now we see more cons than pros.

2 Likes

Ryan I would like to close this as completed, I am renaming to

“Full markdown support in Chat for bots”

Totally open to open another topic here for more general use, but the original request was mostly centered around bots.

3 Likes

We don’t need it for more general use. I was only asking out of curiosity.

I guess maths is going to be another tricky problem… cause that can be pretty common as well

But its a rabbit hole cause GPT4-o can refuse to make mathjax so we would also need a another decoder specially for this.

1 Like

Does such a topic exist? If not, might I create one?

…not least, to support migrations:

(Until it supports all of Discourse’s Markdown, it’s useless to me.)