Documentation
¶
Index ¶
- func Code(fileName, language, code string) (output template.HTML, lexerName string)
- func CodeFromLexer(lexer chroma.Lexer, code string) template.HTML
- func File(fileName, language string, code []byte) ([]template.HTML, string, error)
- func NewContext()
- func PlainText(code []byte) []template.HTML
- func UnsafeSplitHighlightedLines(code template.HTML) (ret [][]byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Code ¶
Code returns an HTML version of code string with chroma syntax highlighting classes and the matched lexer name
func CodeFromLexer ¶
CodeFromLexer returns a HTML version of code string with chroma syntax highlighting classes
func File ¶
File returns a slice of chroma syntax highlighted HTML lines of code and the matched lexer name
func PlainText ¶
PlainText returns non-highlighted HTML for code
func UnsafeSplitHighlightedLines ¶
UnsafeSplitHighlightedLines splits highlighted code into lines preserving HTML tags It always includes '\n', '\n' can appear at the end of each line or in the middle of HTML tags The '\n' is necessary for copying code from web UI to preserve original code lines ATTENTION: It uses the unsafe conversion between string and []byte for performance reason DO NOT make any modification to the returned [][]byte slice items
Types ¶
This section is empty.
Source Files
¶
- highlight.go