Skip to main content

Module style

Module style 

Source
Expand description

A toolkit-neutral text style — the seam that lets one document model drive any frontend.

The WYSIWYG builder (crate::wysiwyg) tags each rendered glyph with one of these instead of a ratatui::Style or a gpui::TextStyle, so the caret model and the AST→glyph layout stay free of any GUI/TUI dependency.

What core records is what a glyph is, never what color to paint it: a Role (heading, code, link, a list bullet, …) plus the portable emphasis the author actually wrote (**bold**, *em*, {+ins+}, {-del-}). Palette is presentation, and presentation belongs to the frontend — a terminal tells a heading from body text by color because color is all it can vary, while a GUI varies size and font instead. So each frontend maps a Role to its own look: leaf-tui turns it into terminal colors, leaf-gpui into an Hsla plus a font size and family. Core stays out of that argument.

Structs§

Style
A glyph’s style: a typographic Role plus the compositional emphasis flags the author wrote. Deliberately no color — that is a frontend’s call, keyed on the Role. Builder methods (.bold, .italic, …) mirror the shape of ratatui’s Style so the WYSIWYG builder reads the same as it did before the split.

Enums§

Baseline
Which line a glyph sits on relative to the text around it.
Role
What a glyph is, typographically — the semantic role a frontend maps to its own presentation. Mutually exclusive per glyph (a glyph is a heading, or a link, or body text — not two at once); the compositional emphasis a run can also carry lives in Style’s bold/italic/underline/strikethrough flags alongside this.