modulepackage
0.0.0-20240515120410-a543606525d2
Repository: https://github.com/sourcegraph/gosyntect.git
Documentation: pkg.go.dev
# README
gosyntect
gosyntect is now part of the Sourcegraph monorepo.
The information below is preserved for archival purposes only.
gosyntect is a Go HTTP client for syntect_server, a Rust HTTP server which syntax highlights code.
Installation
go get -u github.com/sourcegraph/gosyntect/cmd/gosyntect
Usage
usage: gosyntect <server> <theme> <file.go>
example:
gosyntect http://localhost:9238 'InspiredGitHub' gosyntect.go
API
client := gosyntect.New("http://localhost:9238")
resp, err := cl.Highlight(&gosyntect.Query{
Extension: "go",
Theme: "InspiredGitHub",
Code: string(theGoCode),
})
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Data) // prints highlighted HTML
# Packages
No description provided by the author
# Functions
New returns a client connection to a syntect_server.
# Variables
ErrHSSWorkerTimeout occurs when syntect_server's wrapper, http-server-stabilizer notices syntect_server is taking too long to serve a request, has most likely gotten stuck, and as such has been restarted.
ErrInvalidTheme is returned when the Query.Theme is not a valid theme.
ErrPanic occurs when syntect_server panics while highlighting code.
ErrRequestTooLarge is returned when the request is too large for syntect_server to handle (e.g.