Skip to main content

Module inline

Module inline 

Source
Expand description

The inline subset for short texts (ADR 0017): tips, toasts and settings descriptions may carry emphasis, code and links without a markdown renderer. A text is cut into Runs, each drawn as it says; nothing else of markdown is read (no headings, lists, images or HTML: they stay as they are written).

WrittenDrawn
*text*, _text_emphasis
**text**, __text__strong
`code`code
[label](target)a link showing label
<https://…>, a bare https://…a link showing its address
\*a literal * (any ASCII punctuation)

A delimiter opens only when a closing one follows (2 * 3 stays as it is), _ never inside a word (snake_case_name stays as it is), and a code span’s text is taken verbatim.

use egui_pop_model::links::inline::{runs, Run};

let r = runs("Press `Ctrl+K`, see [the guide](docs:guide).");
assert_eq!(r[1], Run { text: "Ctrl+K".into(), code: true, ..Run::default() });
assert_eq!(r[3].link.as_deref(), Some("docs:guide"));
assert_eq!(runs("snake_case_name").len(), 1);

Structs§

Run
A piece of a short text, drawn one way.

Functions§

has_markup
Whether a text uses the subset at all: one without it is drawn as a plain label.
plain
The text without its markup (a link’s label, a code span’s text), for a screen reader or a search.
runs
The runs of a short text, in order; neighbours drawn the same way are merged.