State and updates
Core's inputs and outputs are reactive. As text grows or configuration changes, the existing data flow updates. You do not need to create a new Core instance for each network chunk.
This page continues with text, core, and MarkdownBlock from the quick start.
Append text
Pass the full current content to text.next:
If your source already returns accumulated text, use text.next(fullText) directly.
Subscribe to the list and its content
An update can add a block or change the content of an existing one. Your UI integration needs to handle both:
In an integration, subscribe to a block's value when it enters the list and unsubscribe when it leaves. The outer array and blocks can keep the same references, so reference comparisons alone can miss content updates.
Use renderItem to create a view bound to a content block. Have that view subscribe to block.value instead of reading the tree only once during creation.
Make configuration reactive
For example, enable trailing syntax repair while receiving text and switch to the final presentation when the stream ends. Pass a reactive build when creating Core:
Replace the static build object from the quick start with this state. When the stream finishes:
repair controls the repair system as a whole. repairEnding controls repairs for the streaming tail. The remaining fields enable footnotes, formulas, indented code blocks, and Setext headings.
Enable smooth output
Core includes Smooth but does not enable it automatically. Install @fluxdown/core-presets to configure this preset explicitly:
Add this configuration to the inputs used to create Core:
Once you pass mappers to Core, newly added content enters the output gradually. Your renderer continues to receive updates through its list and content block subscriptions.
When finished, you can turn smoothing off to show the remaining content immediately:
Shad adds fade markers to trailing content. Your renderer must support those nodes to produce a visual fade.
Clean up
Keep each Core instance tied to one content lifecycle. When you are done, cancel your subscriptions, then destroy Core and any externally created inputs:
Core cleans up the states and plugins it creates. You remain responsible for states created outside it.