Crate tui_markup
source · [−]Expand description
tui markup
This crate provides a markup language to quickly write colorful and styled terminal text in plain text.
I suggest to check help.txt in examples folder, which generated this self-describing syntax help document:
For formal syntax specification, see docs/syntax.ebnf.
How two use
let output = tui_markup::compile::<GeneratorType>("<green hello>").unwrap();
The string wrapped in <>
is called a element, start with a tag name, like the green
in above example.
Usable tags vary depending on the the Generator you use, and generator will ignore all tags it does not understand.
So it’s better checkout their document before write your markup text.
Builtin generators
The builtin generators are under feature gates, there is the list:
feature | Target | generator type |
---|---|---|
ansi | Direct print into stdout when using an asni compatible terminal | ANSIStringsGenerator |
tui | Integrated with the popular tui crate | TuiTextGenerator |
The example screenshot above is using the tui
generator, print in Windows Terminal.
If you want write your own generator, please checkout documents of Generator trait.
Modules
Enums
Error for markup source compile pipeline.
Traits
Error with a location info.
Functions
Parse markup language source, then generate final output using the default configure of a generator type.
Parse markup language source, then generate final output using the provided generator.