@treelight/go
v0.6.0
Published
Treelight language module for go.
Downloads
874
Maintainers
Readme
@treelight/go
Go language definition for Treelight.
Install
npm install @treelight/comment @treelight/core @treelight/go @treelight/go-format-string @treelight/regex @treelight/theme-github-darkUsage
import comment from '@treelight/comment';
import { Highlighter } from '@treelight/core';
import go from '@treelight/go';
import goFormatString from '@treelight/go-format-string';
import regex from '@treelight/regex';
import githubDark from '@treelight/theme-github-dark';
const highlighter = await Highlighter.create({
languages: [go, comment, goFormatString, regex],
themes: [githubDark],
theme: 'github-dark',
});
const html = highlighter.highlight('fmt.Println("Hello World!")', 'go');This package includes the Tree-sitter grammar WASM and highlight and injection queries for Go. Its queries can inject comment annotations, block documentation Markdown, //go:generate Bash, regexp patterns, and fmt/log format strings when those target languages are registered.
See the Treelight README for full usage.
