This is an HTTP server that exposes the Rust Syntect syntax highlighting library for use by other services. Send it some code, and it'll send you syntax-highlighted code in response.
Technologies:
SyntaxSet
across Rocket server threads.ThemeSet
(like a global).docker run --detach --name=syntect_server -p 9238:9238 sourcegraph/syntect_server
You can then e.g. GET
http://localhost:9238/health or http://host.docker.internal:9238/health to confirm it is working.
POST
to /
with Content-Type: application/json
. The following fields are required:
filepath
string, e.g. the/file.go
or file.go
or Dockerfile
, see "Supported file extensions" section below.theme
string, e.g. Solarized (dark)
, see "Embedded themes" section below.code
string, i.e. the literal code to highlight.data
field):
data
string with syntax highlighted response. The input code
string is properly escaped and as such can be directly rendered in the browser safely.plaintext
boolean indicating whether a syntax could not be found for the file and instead it was rendered as plain text.error
field), one of:
{"error": "invalid theme", "code": "invalid_theme"}
{"error": "resource not found", "code": "resource_not_found"}
GET
to /health
to receive an OK
health check response / ensure the service is alive.gosyntect is a Go package + CLI program to make requests against syntect_server.
By default on startup, syntect_server
will list all features (themes + file types) it supports. This can be disabled by setting QUIET=true
in the environment.
git clone
this repository anywhere on your filesystem.cargo run
to download dependencies + compile + run the server.Invoke cargo build --release
and an optimized binary will be built (e.g. to ./target/release/syntect_server
).
./build.sh
will build your current repository checkout into a final Docker image.
Run ./publish.sh
after merging your changes.
Once published, the image version will need to be updated in the following locations to make Sourcegraph use it:
sourcegraph/sourcegraph > dev/syntect_server.sh
sourcegraph/sourcegraph > docker-images/syntax-highlighter/build.sh
sourcegraph/sourcegraph > cmd/server/Dockerfile
sourcegraph/sourcegraph > sg.config.yaml
Additionally, it's worth doing a search for other uses in case this list is stale.
cargo fmt
or an editor extension to format code..tmTheme
file anywhere under ./syntect/testdata
(make a new dir if needed) in our fork.cd syntect && make assets
cargo update -p syntect
..tmLanguage
or .sublime-syntax
file and send a PR to our package registry
https://github.com/slimsag/Packages is the package registry we use which holds all of the syntax definitions we use in syntect_server and Sourcegraph. Send a PR there by following these steps
2) Update our temporary fork ofsyntect
We use a temporary fork of syntect
as a hack to get our Packages
registry into the binary. Update it by creating a PR with two commits like:
syntect
Send a PR to this repository with the result of running cargo update -p syntect
.
Run ./publish.sh
to build and release a new image of syntect_server
, and then send a PR to the main Sourcegraph repository like this. Once merged, it will automatically rollout to Sourcegraph.com and go in the next Sourcegraph release.
InspiredGitHub
Monokai
Solarized (dark)
Solarized (light)
Sourcegraph
Sourcegraph (light)
TypeScript
TypeScriptReact
Visual Studio
Visual Studio Dark
base16-eighties.dark
base16-mocha.dark
base16-ocean.dark
base16-ocean.light
txt
)asa
)asp
)vb
)aspx
, ascx
, master
)as
)applescript
, script editor
)bat
, cmd
)build
)cs
, csx
)cpp
, cc
, cp
, cxx
, c++
, C
, h
, hh
, hpp
, hxx
, h++
, inl
, ipp
)c
, h
)CMakeCache.txt
)CMakeLists.txt
, cmake
)cbl
, cpy
, cob
, dds
, ss
, wks
, pco
)jcl
)css
, css.erb
, css.liquid
)capnp
)cg
)clj
, cljc
, cljs
, cljx
, edn
)v
)crontab
)cu
, cuh
)d
, di
)dart
)diff
, patch
)Dockerfile
)dm
, dme
)ex.eex
, exs.eex
)ex
, exs
)html.eex
, html.leex
)ex.re
)ex.sql
)elm
)erl
, hrl
, Emakefile
, emakefile
, escript
)yaws
)sol
)vy
)fs
)fish
)frt
, fs
)essl
, f.essl
, v.essl
, _v.essl
, _f.essl
, _vs.essl
, _fs.essl
)vs
, fs
, gs
, vsh
, fsh
, gsh
, vshader
, fshader
, gshader
, vert
, frag
, geom
, tesc
, tese
, comp
, glsl
)attributes
, gitattributes
, .gitattributes
)COMMIT_EDITMSG
, MERGE_MSG
, TAG_EDITMSG
)gitconfig
, .gitconfig
, .gitmodules
)exclude
, gitignore
, .gitignore
).git
)gitlog
).mailmap
, mailmap
)git-rebase-todo
)go
)graphql
, graphqls
, gql
, graphcool
)dot
, DOT
, gv
)groovy
, gvy
, gradle
, Jenkinsfile
)fx
, fxh
, hlsl
, hlsli
, usf
)html
, htm
, shtml
, xhtml
)hs
)lhs
)cfg
, conf
, ini
, lng
, url
, .buckconfig
, .flowconfig
, .hgrc
)reg
)json
, sublime-settings
, sublime-menu
, sublime-keymap
, sublime-mousemap
, sublime-theme
, sublime-build
, sublime-project
, sublime-completions
, sublime-commands
, sublime-macro
, sublime-color-scheme
, ipynb
, Pipfile.lock
)jsp
)java
, bsh
)properties
)js
, htc
)js
, jsx
)jl
)kt
, kts
)less
)bib
)tex
, ltx
)sty
, cls
)lisp
, cl
, clisp
, l
, mud
, el
, scm
, ss
, lsp
, fasl
)lua
)proj
, targets
, msbuild
, csproj
, vbproj
, fsproj
, vcxproj
)make
, GNUmakefile
, makefile
, Makefile
, makefile.am
, Makefile.am
, makefile.in
, Makefile.in
, OCamlMakefile
, mak
, mk
)man
)md
, mdown
, markdown
, markdn
)matlab
)pom.xml
)mediawiki
, wikipedia
, wiki
)move
)ninja
)nix
)ml
, mli
)mll
)mly
)mm
, M
, h
)m
, h
)php
, php3
, php4
, php5
, php7
, phps
, phpt
, phtml
)pas
, p
, dpr
)pl
, pc
, pm
, pmc
, pod
, t
)ps
, eps
)ps1
, psm1
, psd1
)proto
)pp
, epp
)py
, py3
, pyw
, pyi
, pyx
, pyx.in
, pxd
, pxd.in
, pxi
, pxi.in
, rpy
, cpy
, SConstruct
, Sconstruct
, sconstruct
, SConscript
, pyst
, pyst-include
, gyp
, gypi
, Snakefile
, vpy
, wscript
, bazel
, bzl
)R
, r
, Rprofile
)rd
)rails
, rhtml
, erb
, html.erb
)js.erb
)haml
)rxml
, builder
)erbsql
, sql.erb
)re
)rst
, rest
)rb
, Appfile
, Appraisals
, Berksfile
, Brewfile
, capfile
, cgi
, Cheffile
, config.ru
, Deliverfile
, Fastfile
, fcgi
, Gemfile
, gemspec
, Guardfile
, irbrc
, jbuilder
, Podfile
, podspec
, prawn
, rabl
, rake
, Rakefile
, Rantfile
, rbx
, rjs
, ruby.rail
, Scanfile
, simplecov
, Snapfile
, thor
, Thorfile
, Vagrantfile
)rs
)sass
, scss
)sql
, ddl
, dml
)scala
, sbt
, sc
)sh
, bash
, zsh
, ash
, .bash_aliases
, .bash_completions
, .bash_functions
, .bash_login
, .bash_logout
, .bash_profile
, .bash_variables
, .bashrc
, .profile
, .textmate_init
, .zlogin
, .zlogout
, .zprofile
, .zshenv
, .zshrc
, PKGBUILD
, .ebuild
, .eclass
)st
)tpl
)build_defs
, BUILD.in
, BUILD
, WORKSPACE
, bzl
, sky
, star
, BUILD.bazel
, WORKSPACE
, WORKSPACE.bazel
)styl
, stylus
)swift
)adp
)tcl
)toml
)tf
, tfvars
, hcl
)textile
)thrift
, frugal
)ts
)tsx
)vim
, .vimrc
, .gvimrc
)vue
)xml
, xsd
, xslt
, tld
, dtml
, rng
, rss
, opml
, svg
)yaml
, yml
, sublime-syntax
)zig
)RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4