JuliaSyntaxHighlighting.jl

Author JuliaLang
Popularity
13 Stars
Updated Last
5 Months Ago
Started In
October 2023

Julia Syntax Highlighting

The JuliaSyntaxHighlighting package builds on the StyledStrings and JuliaSyntax standard libraries to provide a simple utility for applying syntax highlighting to text.

julia> using JuliaSyntaxHighlighting: highlight, highlight!

julia> highlight("String(reinterpret(UInt8, [0x293a2061696c756a]))")
"String(reinterpret(UInt8, [0x293a2061696c756a]))" # Colored in the REPL

julia> Base.annotations(ans)
11-element Vector{Tuple{UnitRange{Int64}, Pair{Symbol, Any}}}:
 (1:6, :face => :julia_funcall)
 (1:6, :face => :julia_type)
 (7:7, :face => :julia_rainbow_paren_1)
 (8:18, :face => :julia_funcall)
 (19:19, :face => :julia_rainbow_paren_2)
 (20:24, :face => :julia_type)
 (27:27, :face => :julia_rainbow_bracket_1)
 (28:45, :face => :julia_number)
 (46:46, :face => :julia_rainbow_bracket_1)
 (47:47, :face => :julia_rainbow_paren_2)
 (48:48, :face => :julia_rainbow_paren_1)

Used By Packages