Repository navigation
feat(core): collect code blocks as block slots - #1068
Merged
Merged
Conversation
Adds a `code` block kind: every fenced or indented code block at root, in a blockquote or in an admonition (not in a list) is a slot carrying its `language` and `code`. The id hashes the language alone, so a fence keeps its id while its code streams in and when it closes. The streaming filter now holds back an open fence until its opening line ends, so the info string has finished arriving before the fence shows and its language never changes while it is open. Native code blocks appear one chunk later than before. A kind now fills its own slot fields and identity instead of everything going through url/text/title. The collector also sets `BlockSlot::node` and records the last code block in document order, so a host can tell which slot an open fence belongs to. The TurboModule skips code slots until the hosts can place them.
The empty line after a final newline counted as a line outside the quote, so a quoted or admonition fence read as closed every time a line ended and open again mid-line. A blank last line now leaves the fence open. Adds isSlotComplete, so the hosts read which code slot is still streaming from core instead of comparing lastCodeBlock themselves.
A slot's kind-specific fields are now one alternative of a variant, so a code slot no longer carries an empty url, alt text and title, and the kind can't disagree with the fields filled in.
hryhoriiK97
force-pushed
the
feat/code-renderers-core
branch
from
November 2, 2026 15:34
99a3689 to
6be83d2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why?
First step of the code block renderers stack.
This PR adds a
codeblock kind to the C++ block slot collector, so the rest of the stack can replace code blocks with React renderers.languageandcode. This applies at the root, in a blockquote or in an admonition, but not inside a list. The slot id hashes only the language, so it stays the same while the code streams in and after the fence closes.fillfunction, replacing the sharedurl/text/titlepath. The collector also setsBlockSlot::nodeand records the last code block in document order, so a host can tell which slot an open fence belongs to.Testing
block_slots_test.cpp(collection, placement, id stability while code streams) andstreaming_filter_test.cpp(open fence held until its opening line ends).block_slot_ids.txtfixture.PR Checklist