Skip to content

How to handle partial markdown syntax when rendering streamed output #858

Open
@JamesNK

Description

@JamesNK

It's common to return markdown in AI responses. With streaming, markdown returned will have partially complete syntax as the response is returned.

For example, the start sequence for an inline or fenced code block is returned in the stream response, but end sequence doesn't arrive for another second. Inbetween that time the start sequence is rendered as text to the HTML output, which doesn't look good.

This is some code: `I'm not complete

Is there a way to exclude partially received syntax from rendered HTML? e.g. if a backtick is received to start an inline code span, the backtick and content after it isn't rendered until the end backtick is received:

This is some code:

Alternatively, a way to implicitly complete the begun start sequence, e.g.

This is some code: I'm not complete

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions