showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript
http://www.showdownjs.com/
MIT License
14.34k stars 1.57k forks source link

markdown from openAi streamed data gives weird results #1000

Open itscvenk opened 9 months ago

itscvenk commented 9 months ago

When I use with OpenAi API streamed data, i get weird results

` const div = document.getElementById(uuid); let converter = new showdown.Converter({smoothLivePreview: true}); let parsedHtml = converter.makeHtml(txt);

`

The result is something like this when i add it to a div using innerHtml (see image please)

All the chunks go into a new line and the markdown isn't parsed :-(

image

EDITED

showdownjs parses the text and adds a "html p" tag to every streamed word in every text :-(

And the markdown isn't applied either . I used the code from https://github.com/orhanerday/ChatGPT and just referenced latest version of showdownjs and added the above code for the parsing

Also tried without the smoothLivePreview . No luck :-(

Please help