Documentation
¶
Overview ¶
Package termd provides terminal markdown rendering, with code block syntax highlighting support.
Example ¶
var c termd.Compiler
c.SyntaxHighlighter = termd.SyntaxTheme{
"keyword": termd.Style{},
"comment": termd.Style{
Color: "#323232",
},
"literal": termd.Style{
Color: "#555555",
},
"name": termd.Style{
Color: "#777777",
},
"name.function": termd.Style{
Color: "#444444",
},
"literal.string": termd.Style{
Color: "#333333",
},
}
b, _ := ioutil.ReadFile("testdata/example.md")
fmt.Printf("%s\n", c.Compile(string(b)))
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compiler ¶
type Compiler struct {
// Columns is the number of columns to wrap text, defaulting to 90.
Columns int
// Markdown is an optional instance of a blackfriday markdown parser,
// defaulting to one with CommonExtensions enabled.
Markdown *blackfriday.Markdown
// SyntaxHighlighter is an optional syntax highlighter for code blocks,
// using the low-level SyntaxHighlighter interface, or SyntaxTheme map.
SyntaxHighlighter
// contains filtered or unexported fields
}
Compiler is the markdown to text compiler. The zero value can be used.
type Style ¶
type Style struct {
Color string `json:"color"`
Background string `json:"background"`
Bold bool `json:"bold"`
Faint bool `json:"faint"`
Italic bool `json:"italic"`
Underline bool `json:"underline"`
}
Style is the configuration used to style a particular token.
type SyntaxHighlighter ¶
SyntaxHighlighter is the interface used to highlight blocks of code.
type SyntaxTheme ¶
SyntaxTheme is a map of token names to style configurations.
Click to show internal directories.
Click to hide internal directories.
