Skip to content

Commit 30b16bd

Browse files
committed
Add example usage to readme
1 parent 3592132 commit 30b16bd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,24 @@
88
The `JuliaSyntaxHighlighting` package builds on the `StyledStrings` and
99
`JuliaSyntax` standard libraries to provide a simple utility for applying syntax
1010
highlighting to text.
11+
12+
```julia-repl
13+
julia> using JuliaSyntaxHighlighting: highlight, highlight!
14+
15+
julia> highlight("String(reinterpret(UInt8, [0x293a2061696c756a]))")
16+
"String(reinterpret(UInt8, [0x293a2061696c756a]))" # Colored in the REPL
17+
18+
julia> Base.annotations(ans)
19+
11-element Vector{Tuple{UnitRange{Int64}, Pair{Symbol, Any}}}:
20+
(1:6, :face => :julia_funcall)
21+
(1:6, :face => :julia_type)
22+
(7:7, :face => :julia_rainbow_paren_1)
23+
(8:18, :face => :julia_funcall)
24+
(19:19, :face => :julia_rainbow_paren_2)
25+
(20:24, :face => :julia_type)
26+
(27:27, :face => :julia_rainbow_bracket_1)
27+
(28:45, :face => :julia_number)
28+
(46:46, :face => :julia_rainbow_bracket_1)
29+
(47:47, :face => :julia_rainbow_paren_2)
30+
(48:48, :face => :julia_rainbow_paren_1)
31+
```

0 commit comments

Comments
 (0)