You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Flexmark to parse Markdown responses from ChatGPT and render them as HTML in a JavaFX application. ChatGPT may return the response all at once, or as a sequence of chunks (streamed tokens). This streaming behavior introduces a challenge when parsing incomplete Markdown constructs.
For example, consider the following input where the Markdown is received in chunks (delimited here by | for clarity - can be in the middle of a text block):
## My | Suggestion
Your query | can __be |improved__ by adding one more table.
If I parse each chunk individually, Flexmark treats '## My' and 'Answer' as separate text nodes instead of one heading, and similarly fails to recognize the emphasis syntax across chunks.
My questions:
Is there a way in Flexmark to detect whether the currently parsed content represents a complete block (e.g., a full heading or paragraph)?
How can I implement a buffering mechanism, collecting incoming chunks until a block is likely complete before passing them JavaFX WebView to render?
I’d appreciate any guidance or best practices for working with incremental Markdown input using Flexmark.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Flexmark to parse Markdown responses from ChatGPT and render them as HTML in a JavaFX application. ChatGPT may return the response all at once, or as a sequence of chunks (streamed tokens). This streaming behavior introduces a challenge when parsing incomplete Markdown constructs.
For example, consider the following input where the Markdown is received in chunks (delimited here by | for clarity - can be in the middle of a text block):
If I parse each chunk individually, Flexmark treats '## My' and 'Answer' as separate text nodes instead of one heading, and similarly fails to recognize the emphasis syntax across chunks.
My questions:
Is there a way in Flexmark to detect whether the currently parsed content represents a complete block (e.g., a full heading or paragraph)?
How can I implement a buffering mechanism, collecting incoming chunks until a block is likely complete before passing them JavaFX WebView to render?
I’d appreciate any guidance or best practices for working with incremental Markdown input using Flexmark.
Beta Was this translation helpful? Give feedback.
All reactions