Skip to content
Go HTTP client for syntect_server
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/gosyntect
LICENSE
README.md
go.mod
go.sum
gosyntect.go

README.md

gosyntect

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
You can’t perform that action at this time.