Documentation
¶
Overview ¶
Package colorcode is a simple wrapper around the alecthomas/chroma package.
Index ¶
- func Bash(content string) string
- func Batch(content string) string
- func C(content string) string
- func CPP(content string) string
- func CSharp(content string) string
- func Colorize(lexerName, content string) string
- func Diff(content string) string
- func Go(content string) string
- func JSON(content string) string
- func Java(content string) string
- func PrettyJSON(data interface{})
- func Python2(content string) string
- func Python3(content string) string
- func SetTheme(theme string) error
- func TOML(content string) string
- func YAML(content string) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bash ¶
Bash - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/b/bash.go
func Batch ¶
Batch - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/b/batch.go
func C ¶
C - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/c/c.go
func CPP ¶
CPP - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/c/cpp.go
func CSharp ¶
CSharp - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/c/csharp.go
func Diff ¶
Diff - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/d/diff.go
func Go ¶
Go - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/g/go.go
func JSON ¶
JSON - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/j/json.go
func Java ¶
Java - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/j/java.go
func PrettyJSON ¶
func PrettyJSON(data interface{})
PrettyJSON outputs a pretty-printed JSON string with syntax highlighting.
Example ¶
PrettyJSON illustrates the use of PrettyJSON with immediate data structure.
package main
import (
"bitbucket.org/ai69/colorcode"
)
func main() {
type dataSchema struct {
A string
B []int
C map[string]int
D map[string]interface{}
E bool
F float64
h string
}
a := dataSchema{
A: "hello",
B: []int{1, 2, 3},
C: map[string]int{"a": 1, "b": 2},
D: map[string]interface{}{"a": 1, "b": "<b>Aloha!</b>", "c": []int{1, 2, 3, 4, 5}},
E: true,
F: 3.1415926,
h: "hidden",
}
colorcode.PrettyJSON(&a)
}
func Python2 ¶
Python2 - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/p/python2.go
func Python3 ¶
Python3 - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/p/python.go
func SetTheme ¶
SetTheme sets the global theme for the colorized output. See Reference: https://xyproto.github.io/splash/docs/
func TOML ¶
TOML - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/t/toml.go
func YAML ¶
YAML - See reference: https://github.com/alecthomas/chroma/blob/master/lexers/y/yaml.go
Types ¶
This section is empty.