Skip to content

Commit

Permalink
Introduce new syntax highlighting stdlib (#51810)
Browse files Browse the repository at this point in the history
Having this as a standard library allows for syntax highlighting to be
used in the Markdown and REPL standard libraries. As a bonus, this
provides an easy and canonical way of obtaining syntax highlighted code
across the ecosystem.

This is a pretty tiny library, at just ~200 lines, but a useful one.
  • Loading branch information
tecosaur authored Jan 24, 2024
1 parent 81c4f8e commit e74f9e4
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ Standard library changes
* The new `@styled_str` string macro provides a convenient way of creating a
`AnnotatedString` with various faces or other attributes applied ([#49586]).

#### JuliaSyntaxHighlighting

* A new standard library for applying syntax highlighting to Julia code, this
uses `JuliaSyntax` and `StyledStrings` to implement a `highlight` function
that creates an `AnnotatedString` with syntax highlighting applied.

#### Package Manager

#### LinearAlgebra
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
08230d0801fda3c81927d558452215e4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0386841dcf30ee53f7f95dd3206e1208482507d157aa09739873de2a56e5ca3d7bbf27eccd9f4ed81c1c0fea229673475f6454fe94df0ff960563ca4c29ed36c
1 change: 1 addition & 0 deletions pkgimage.mk
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ $(eval $(call stdlib_builder,Printf,Unicode))
$(eval $(call stdlib_builder,Random,SHA))
$(eval $(call stdlib_builder,Tar,ArgTools,SHA))
$(eval $(call stdlib_builder,DelimitedFiles,Mmap))
$(eval $(call stdlib_builder,JuliaSyntaxHighlighting,))

# 2-depth packages
$(eval $(call stdlib_builder,LLD_jll,Zlib_jll libLLVM_jll Artifacts Libdl))
Expand Down
2 changes: 2 additions & 0 deletions stdlib/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
/Distributed
/StyledStrings-*
/StyledStrings
/JuliaSyntaxHighlighting-*
/JuliaSyntaxHighlighting
/*_jll/StdlibArtifacts.toml
/*/Manifest.toml
/*.image
4 changes: 4 additions & 0 deletions stdlib/JuliaSyntaxHighlighting.version
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
JULIASYNTAXHIGHLIGHTING_BRANCH = main
JULIASYNTAXHIGHLIGHTING_SHA1 = 4110caaf4fcdf0c614fd3ecd7c5bf589ca82ac63
JULIASYNTAXHIGHLIGHTING_GIT_URL := https://github.com/julialang/JuliaSyntaxHighlighting.jl.git
JULIASYNTAXHIGHLIGHTING_TAR_URL = https://api.github.com/repos/julialang/JuliaSyntaxHighlighting.jl/tarball/$1
3 changes: 2 additions & 1 deletion stdlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ STDLIBS = Artifacts Base64 CRC32c Dates FileWatching \
$(JLL_NAMES)

STDLIBS_EXT = Pkg Statistics LazyArtifacts LibCURL DelimitedFiles Downloads ArgTools \
Tar NetworkOptions SuiteSparse SparseArrays StyledStrings SHA Distributed
Tar NetworkOptions SuiteSparse SparseArrays StyledStrings SHA Distributed \
JuliaSyntaxHighlighting

$(foreach module, $(STDLIBS_EXT), $(eval $(call stdlib-external,$(module),$(shell echo $(module) | tr a-z A-Z))))

Expand Down
6 changes: 3 additions & 3 deletions stdlib/stdlib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ STDLIBS_WITHIN_SYSIMG := \

INDEPENDENT_STDLIBS := \
ArgTools Base64 CRC32c Dates DelimitedFiles Distributed Downloads Future \
InteractiveUtils LazyArtifacts LibGit2 LibCURL Logging Markdown Mmap \
NetworkOptions Profile Printf Pkg REPL Serialization SharedArrays SparseArrays \
Statistics StyledStrings Tar Test TOML Unicode UUIDs \
InteractiveUtils JuliaSyntaxHighlighting LazyArtifacts LibGit2 LibCURL Logging \
Markdown Mmap NetworkOptions Profile Printf Pkg REPL Serialization SharedArrays \
SparseArrays Statistics StyledStrings Tar Test TOML Unicode UUIDs \
dSFMT_jll GMP_jll libLLVM_jll LLD_jll LLVMLibUnwind_jll LibUnwind_jll LibUV_jll \
LibCURL_jll LibSSH2_jll LibGit2_jll nghttp2_jll MozillaCACerts_jll MbedTLS_jll \
MPFR_jll OpenLibm_jll PCRE2_jll p7zip_jll Zlib_jll
Expand Down

0 comments on commit e74f9e4

Please sign in to comment.