From d26e293387d1ead5e0cfac1f3d8ab452d34daeee Mon Sep 17 00:00:00 2001 From: Mohith26 <109003762+Mohith26@users.noreply.github.com> Date: Wed, 4 Nov 2026 01:18:27 -0500 Subject: [PATCH 1/2] fix(core): withhold partial fence and math markers at the end of a streamed prefix The first one or two backticks or tildes of a fence opener, the start of an open fence's closing fence, and a lone $ before $$ showed as text or as a line of code and then vanished once the delimiter completed. The streaming filter now withholds them until the next character decides, so the result is the one the stream had before they arrived. Fixes #1130. --- .../markdown-streaming.md | 4 +- packages/core/cpp/parser/StreamingFilter.cpp | 42 ++++++++++++++++++- packages/core/cpp/parser/StreamingFilter.hpp | 3 ++ .../core/cpp/tests/streaming_filter_fuzz.cpp | 39 ++++++++++++++++- .../core/cpp/tests/streaming_filter_test.cpp | 41 ++++++++++++++++++ 5 files changed, 124 insertions(+), 5 deletions(-) diff --git a/docs/docs/rich-text-formatting/markdown-streaming.md b/docs/docs/rich-text-formatting/markdown-streaming.md index 5939d576b..35e3cc0a4 100644 --- a/docs/docs/rich-text-formatting/markdown-streaming.md +++ b/docs/docs/rich-text-formatting/markdown-streaming.md @@ -52,7 +52,7 @@ It takes **two** conditions, not one: `streamingAnimation` must be on **and** th | Mode | Behavior | | --- | --- | -| `'progressive'` (default) | Streams the code line-by-line with a visible but non-interactive header (copying is disabled until the block completes); syntax highlighting is deferred until the closing fence so it does not flicker on every token. The block appears once the line that opens the fence has ended, so its language label never changes. | +| `'progressive'` (default) | Streams the code line-by-line with a visible but non-interactive header (copying is disabled until the block completes); syntax highlighting is deferred until the closing fence so it does not flicker on every token. The block appears once the line that opens the fence has ended, so its language label never changes. The first one or two backticks or tildes of a fence, and the start of its closing fence, are withheld until the next character arrives, so they never flash as text or as a line of code. | | `'hidden'` | Withholds the whole block until its closing fence arrives, then shows it complete. | A code block drawn by [`renderers.code`](/react-native/guides/custom-block-renderers#code-blocks) follows the same modes. In `'progressive'` its element re-renders with the growing code and receives `isComplete: false` until the closing fence arrives. @@ -64,7 +64,7 @@ A code block drawn by [`renderers.code`](/react-native/guides/custom-block-rende | `'progressive'` (default) | Shows a trailing image paragraph, link paragraph or `