Closed CNSeniorious000 closed 2 days ago
Hi @CNSeniorious000 to be honest, I don't understand the issue. Is it just that while the Markdown component is streaming text, the text should be selectable? How would that even work with the text constantly changing?
Sorry, it seems I haven't done enough research. I tried the markdown component on HuggingFace Chat, and it seems to already support partial updating during streaming. If I still think there's an issue, I will provide a minimal reproducible example and a more detailed explanation. I'll close this issue for now. Thank you for responding!
Is your feature request related to a problem?
Currently you can't select text on the document in a streaming markdown component. People can only select text after the markdown when completed. The UX is not perfect.
Describe the solution you'd like
Expose a
stream
parameter to the python side, if user chooses it, then the markdown html should be rendered by "partial update" instead of "full update" each time.Additional context
I can make a PR if you decided it acceptable. Here is my plan:
https://github.com/gradio-app/gradio/blob/4d67d39477b7ec7ad987526f7afc629487d0fdd5/js/markdown-code/MarkdownCode.svelte#L97-L101
Usually Svelte generative UI application streams markdown in the markdown-ast level. But I found that you patched the raw HTML after rendering markdown to HTML:
https://github.com/gradio-app/gradio/blob/4d67d39477b7ec7ad987526f7afc629487d0fdd5/js/markdown-code/MarkdownCode.svelte#L52-L60
So I think my solution is to render the HTML using
hast
withrehype
.