module LTerm_text: sig
.. end
Styled text.
type
t = (CamomileLibrary.UChar.t * LTerm_style.t) array
Type of a string with styles for each characters.
Conversions
val of_string : Zed_utf8.t -> t
Creates a styled string from a string. All characters of the
string have no style.
val to_string : t -> Zed_utf8.t
Returns the string part of a styled string.
val of_string_maybe_invalid : string -> t
Creates a styled string from a string. All characters of the
string have no style. The string may contain invalid UTF-8
sequences, in which case invalid bytes are escaped with the
syntax \yXX
.
val of_rope : Zed_rope.t -> t
Creates a styled string from a rope.
val to_rope : t -> Zed_rope.t
Returns the string part of a styled string as a rope.
val stylise : string -> LTerm_style.t -> t
stylise string style
creates a styled string with all styles
set to style
.
Parenthesis matching
val stylise_parenthesis : t ->
?paren:(CamomileLibrary.UChar.t * CamomileLibrary.UChar.t) list ->
int -> LTerm_style.t -> unit
stylise_parenthesis text ?paren pos style
searchs for
parenthesis group starting or ending at pos
and apply them the
style style
. paren
is the list of parenthesis recognized.
Markup strings
Markup strings are used to conveniently define styled strings.
type
item =
| |
S of Zed_utf8.t |
| |
R of Zed_rope.t |
| |
B_bold of bool |
| |
E_bold |
| |
B_underline of bool |
| |
E_underline |
| |
B_blink of bool |
| |
E_blink |
| |
B_reverse of bool |
| |
E_reverse |
| |
B_fg of LTerm_style.color |
| |
E_fg |
| |
B_bg of LTerm_style.color |
| |
E_bg |
Type of an item in a markup string.
type
markup = item list
Type of a markup string.
val eval : markup -> t
eval makrup
evaluates a markup strings as a styled string.