The Markdown Chat sample shows one of the highest-leverage patterns in this repository: exact-height-first virtualization.
Instead of measuring a live UI tree, the sample:
PretextConversationFrameTraditional rich chat UIs often depend on UI-tree or DOM measurement after layout. That makes virtualization harder because height is discovered late.
The sample reverses that:
| API | Role in the sample |
|---|---|
PrepareRichInline |
Prepared paragraph-like inline content for markdown text runs. |
MeasureRichInlineStats |
Predicted inline block height from line count and widest line. |
WalkRichInlineLineRanges |
Streamed visible inline lines during materialization. |
PrepareWithSegments(..., new PrepareOptions(WhiteSpaceMode.PreWrap)) |
Prepared fenced code blocks. |
MeasureLineStats |
Predicted code-block line count and width. |
LayoutWithLines |
Materialized code-block lines once a visible message is being rendered. |
The sample treats a chat message as a block container with a few leaf types:
This is the important architectural point: Pretext stays the paragraph leaf, while the sample owns the higher-level block layout rules.
samples/PretextSamples/Samples/MarkdownChatData.cssamples/PretextSamples/Samples/MarkdownChatModel.cssamples/PretextSamples/Samples/MarkdownChatSampleView.csIf your application can convert rich content into deterministic block and inline templates, Pretext gives you the measurement pieces needed to virtualize large scroll surfaces without waiting for a live layout pass.