Expand description
ANSI escape code rendering for the web
Yew
html! {
<AnsiStatic text="Hello \u{001b}[32mWorld\u{001b}[39;1m!" />
}
This will generate the following output (whitespace added for clarity):
<pre style="font-family: monospace">
<span>Hello </span>
<span style="color:#00ff00;">World</span>
<span style="font-weight:bold;">!</span>
</pre>
Refer to AnsiRenderer
and AnsiProps
for more details.
Parsing
If you want to parse text containing ANSI escape codes you can use get_sgr_segments
to iterate over text segments along with their SgrEffect
.
If you need more control, use get_markers
to iterate over the raw Escape
codes in the text.
Structs
- Props that can be passed to the
AnsiRenderer
component. - Component for rendering text containing ANSI escape codes.
- Cursor for characters in a string slice.
- Combination of classes and inline styles.
- Style builder using only inline style attributes.
- Iterator yielding markers in a string.
- Describes the effect that multiple SGR parameters have on text.
- Iterator over the SGR segments in a string slice.
Enums
- Describes the color effect of multiple SGR parameters.
- The 8 colors defined by the original specification.
- Control sequence.
- ANSI Escape Sequence.
- Parts of a string containing ANSI escape sequences.
- Select Graphic Rendition parameter.
Traits
- Builder for
ClassStyle
.
Functions
- Iterate over all
Marker
s in given string. - Create an iterator which iterates over SGR segments in a string slice. Each item consists of a
SgrEffect
and the corresponding text slice it applies to. - Read the next sequence in the given slice. Returns the content before the escape sequence, the escape sequence itself, and everything following it. The escape sequence can be
None
if it’s invalid. If the slice doesn’t contain an escape sequence the entire string slice will be returned as the first item.
Type Aliases
- ANSI component which takes a
String
. - ANSI component which takes a
Rc<String>
. - ANSI component which takes a
&'static str
.