Build lists
use std::io;
use urushi::{List, ListItem, ThemePreset};
fn main() -> io::Result<()> { let theme = ThemePreset::get("Catppuccin Mocha") .expect("built-in theme") .theme(); let steps = List::new() .item("Compile") .item(ListItem::new("Test").item("unit").item("integration")) .item("Package");
urushi::println_view(&theme.list(&steps))}• Compile• Test • unit • integration• Packagehidden(true) removes an item and all descendants. offset(start, end) omits
visible candidates from the beginning and end of one sibling group. The same
operations exist on the top-level List and nested ListItem values.
For numbering, clone the theme presentation and replace its enumerator:
use std::io;
use urushi::{List, ListItem, ThemePreset, arabic_enumerator};
fn main() -> io::Result<()> { let theme = ThemePreset::get("Catppuccin Mocha") .expect("built-in theme") .theme(); let steps = List::new() .item("Compile") .item(ListItem::new("Test").item("unit").item("integration")) .item("Package"); let presentation = theme .components() .list() .clone() .enumerator(arabic_enumerator) .nesting_indent(4);
urushi::println_view(&presentation.compose(&steps))}1. Compile2. Test 1. unit 2. integration3. PackageBuilt-ins include bullet, dash, asterisk, Arabic numeral, uppercase alphabetic, and uppercase Roman numeral enumerators.
• item - item * item 1. item A. item I. itemSelect a visible range
Section titled “Select a visible range”Visibility is data, not presentation. hidden(true) removes an item and its
descendants. offset(start, end) is applied independently to each sibling
group and saturates to an empty group when it omits every candidate.
let list = List::new() .item("hidden first") .item( ListItem::new("kept") .item("child") .item(ListItem::new("hidden subtree").item("descendant").hidden(true)), ) .item("hidden last") .offset(1, 1);let view = theme.list(&list);• kept • childThe top-level offset(1, 1) removes the first and last siblings. The nested
hidden(true) removes both hidden subtree and its descendant; hiding differs
from selecting a sibling window.