Skip to main content

Module render

Module render 

Source
Expand description

Doc → gpui elements.

Numbers drive layout (sizes, line heights, paddings — the constants here); colors are paint, read from Theme. Blocks are a flat list, so nesting is left padding rather than nested containers, and the gap between two blocks is decided by the pair: list items sit tight, everything else breathes.

Ported from zeronsh/comet (MIT) and rebuilt against the flat block model.

Structs§

BlockLayouts
Where each block’s text landed, recorded as it painted.
Editing
What an editor paints over a document.
Flat
Inline content flattened for shaping: one string, its runs, and the ranges that need painting underneath (link clicks, inline-code washes, chips).

Enums§

Annotation
A range the caller wants washed, and which of the three washes it gets.
Caption
What an image’s one authored string is doing on the page.

Constants§

PLAIN_LANGUAGE
What a fence with no info string calls itself, in its header and in a picker — one spelling, so the label and the menu row cannot disagree.

Functions§

flatten
Marks are ranges, gpui wants consecutive runs — so cut the text at every mark boundary and ask which marks cover each piece.
markdown
Parse and render in one step — the common case for read-only content.
render
Render a document.
render_with
Render a document with a caret and a selection in it.