Skip to content

Documents and references

Use one renderer for one message unless your layout needs independently mounted sections. Document coordination lets those sections share links, images and footnotes. It does not concatenate their Markdown before parsing.

InputRecommended rendering
A message arriving in network packetsAccumulate one string and update one renderer
Separate chat messages with unrelated citationsIndependent renderers with independent document identities
One answer displayed as independently parseable sectionsMultiple renderers inside a document provider, sharing an explicit document ID
Server-only output requiring all references resolvedOne renderer receiving the complete logical document

A fence, table row, emphasis span or formula split across renderer boundaries is still split syntax. The registry can supply a definition from another section; it cannot repair such boundaries.

Both adapters export their own AIMarkdownDocuments. Put coordinated renderers inside the provider from the same framework and give them the same explicit documentId. Automatically generated IDs keep standalone renderers independent. React additionally requires blockMemo to remain enabled (its default) for cross-chunk coordination; Vue has no blockMemo prop.

Use stable component keys. Supply documentIndex when your sections can reorder or remount, so reference ordering follows the intended document order. Smooth turn-taking uses registration order, not documentIndex.

Different document IDs and different provider instances remain independent. Changing a section’s document ID or unmounting it releases its old registration. Keep a provider scoped to the application area that owns those documents.

A reference can appear before its definition is available. Once mounted contributions commit, the registry supplies shared destinations and global footnote numbering. Updating or removing a definition updates its readers. The last registered chunk owns the aggregate footnote footer.

Server rendering and the first hydration render use local content and local footnotes. Definitions contributed only by other chunks are not pre-resolved in server HTML. If a complete server-rendered document is required, pass all of its source to a single renderer.

Reference coordination and smooth turn-taking solve separate problems. Only smooth participants join the reveal queue. A section mounted with existing content keeps that content visible; an empty section can wait for an earlier smooth section to finish producing and draining.