Term

Term.CodeThemeType

Custom hilighting theme for Highlighters.jl https://juliadocs.github.io/Highlights.jl/stable/man/theme/

source
Term.ThemeType
Theme

Stores colors for different semantically relevant items, used to style outputs to terminal.

source
Term.cleantextMethod
cleantext(str::AbstractString)

Remove all style information from a string.

source
Term.do_by_lineMethod
do_by_line(fn::Function, text::AbstractString)

Apply fn to each line in the text.

The function fn should accept a single ::AbstractString argument.

source
Term.escape_bracketsMethod
remove_ansi(str::AbstractString)::AbstractString

Replace each squared bracket with a double copy of itself

source
Term.get_last_valid_str_idxMethod
get_last_valid_str_idx(str::AbstractString, idx::Int)

Get valid index to cut a string at.

When indexing a string, the number of indices is given by the the sum of the ncodeunits of each Char, but some indices will not be valid. This function ensures that given a (potentially) not valid index, the last valid one is elected.

source
Term.get_next_valid_str_idxMethod

getnextvalidstridx(str::AbstractString, idx::Int)

Get valid index to cut a string at.

When indexing a string, the number of indices is given by the the sum of the ncodeunits of each Char, but some indices will not be valid. This function ensures that given a (potentially) not valid index, the next valid one is elected.

source
Term.get_valid_chars!Method
get_valid_chars!(valid_chars::Vector{Int}, tag, δ::Int)

Recursively extract valid characters (i.e. not in markup tags) from a string.

source
Term.highlightMethod
highlight(text::AbstractString, theme::Theme, like::Symbol)

Hilights an entire text as if it was a type of semantically relevant text of type :like.

source
Term.highlightMethod
highlight(text::AbstractString, theme::Theme)

Highlighs a text introducing markup to style semantically relevant segments, colors specified by a theme object

source
Term.load_code_and_highlightMethod
load_code_and_highlight(path::AbstractString, lineno::Int; δ::Int=3, width::INt=120)

Load a file, get the code and format it. Return styled text

source
Term.read_file_linesMethod
read_file_lines(path::String, start::Int, stop::Int)

Read a file and select only lines in range start -> stop.

Returns a vector of tuples with the line number and line content.

source
Term.remove_ansiMethod
remove_ansi(str::AbstractString)::AbstractString

Remove all ANSI tags from a string of text

source
Term.remove_markupMethod
remove_markup(input_text::AbstractString)::AbstractString

Remove all markup tags from a string of text.

source
Term.replace_double_bracketsMethod
replace_double_brackets(text::AbstractString)::AbstractString

Replace double brackets with %% and ±± to avoid them being picked up by markup extraction

source
Term.replace_textFunction
replace_text(text::AbstractString, start::Int, stop::Int, char::Char='_')

Replace a section of a text between start and stop with another string composed of repeats of a given character char.

source
Term.replace_textMethod
replace_text(text::AbstractString, start::Int, stop::Int, replace::AbstractString)

Replace a section of a text between start and stop with replace.

source
Term.reshape_textMethod
reshape_text(text::AbstractString, width::Int)

Reshape text to have a given width.

When text is longer than width, it gets cut into multiple lines. This is done carefully to preserve style information by: avoiding cutting inside style markup and copying markup tags over to new lines so that the style is correctly applied.

source
Term.textlenMethod
textlen(x::AbstractString)

Get length of text after all style information is removed.

source
Term.truncateMethod
truncate(text::AbstractString, width::Int)

Shorten a string of text to a target width

source
Term.unescape_bracketsMethod
unescape_brackets(text::AbstractString)::AbstractString

Replece every double squared parenthesis with a single copy of itself

source
Term.@styleMacro
@style "text" style1 style2...

Applies a sequence of styles to a piece of text, such that

println(@style "my text" bold green underline)

will print my text as bold, green and underlined

source