How to properly format streamed responses?

Is there a way to automatically format streamed responses? I fixed some issues with css white-space: pre-wrap; but it would be great if lists, quotes, etc were properly formatted in the response. I haven’t tried a response that requires code, but I’m assuming a similar issue would happen. Here is a screenshot of the latest output. Any recommendations?

have you considered using a markdown formatter?

I’m new to this so I’m not aware of that but sounds promising. Can you point me in the right direction for implementing that?

is pretty popular :slight_smile:


If I’m reading that right, this is only for JS. I’m using python :frowning:

You’re using css in python?

there’s probably some python markdown->html converters out there.

Oops no. My bad. I’ll take a closer look.

A good start is simply to have linefeed characters WORK in the GUI element you are using. Send them as <br> or containerize paragraphs if this is an HTML-only render element.

Then control the GUI box width for better readability of that variable width text.