Documentation ¶
Index ¶
- Variables
- type ChromaHighlight
- func (c *ChromaHighlight) ClrBuffer()
- func (c *ChromaHighlight) Highlight(inputString, lexerName, styleName string) (err error)
- func (c *ChromaHighlight) Initialised() bool
- func (c *ChromaHighlight) RemoveTags()
- func (c *ChromaHighlight) ToFile(filename string) (err error)
- func (c *ChromaHighlight) ToTextBuff() (err error)
Constants ¶
This section is empty.
Variables ¶
var Hfmrow = styles.Register(chroma.MustNewStyle("hfmrow", chroma.StyleEntries{ chroma.Whitespace: "#C0C0C0 ", chroma.Comment: "#D94B00", chroma.CommentPreproc: "#BC7A00", chroma.CommentSpecial: "bg:#E0E0E0 bold #006000", chroma.Keyword: "bold #000080", chroma.KeywordPseudo: "nobold", chroma.KeywordType: "bold #366F36", chroma.KeywordConstant: "bold #3F0000", chroma.KeywordDeclaration: "bold #000080", chroma.Operator: "bold #234567", chroma.OperatorWord: "bold #542111", chroma.NameBuiltin: "bold #5F1860", chroma.NameFunction: "bold #18455E", chroma.NameClass: "bold #0000FF", chroma.NameNamespace: "bold #0000FF", chroma.NameException: "bold #D2413A", chroma.NameVariable: "#366F36", chroma.NameConstant: "#366F36", chroma.NameLabel: "#A0A000", chroma.NameEntity: "bold #999999", chroma.NameAttribute: "#7D9029", chroma.NameTag: "bold #008000", chroma.NameDecorator: "#AA22FF", chroma.String: "#0E6200", chroma.StringDoc: "italic", chroma.StringInterpol: "bold #0E6200", chroma.StringEscape: "bold #0E6266", chroma.StringRegex: "#0E6233", chroma.StringSymbol: "#19177C", chroma.StringOther: "#008000", chroma.Number: "#450099", chroma.GenericHeading: "bold #000080", chroma.GenericSubheading: "bold #800080", chroma.GenericDeleted: "#A00000", chroma.GenericInserted: "#00A000", chroma.GenericError: "#FF0000", chroma.GenericEmph: "italic", chroma.GenericStrong: "bold", chroma.GenericPrompt: "bold #000080", chroma.GenericOutput: "#888", chroma.GenericTraceback: "#04D", chroma.GenericUnderline: "underline", chroma.Error: "border:#FF0000", }))
Hfmrow default theme.
var HfmrowGithub = styles.Register(chroma.MustNewStyle("hfmrow-github", chroma.StyleEntries{ chroma.Whitespace: "#C0C0C0 ", chroma.Comment: "#6A737D", chroma.CommentPreproc: "#6A737D", chroma.Keyword: "#FF1010", chroma.KeywordPseudo: "nobold", chroma.KeywordType: "#E46209", chroma.KeywordConstant: "#FF0000", chroma.KeywordDeclaration: "#E46209", chroma.Operator: "#234567", chroma.OperatorWord: "#D83A49", chroma.NameBuiltin: "#FF1010", chroma.NameFunction: "#6138AA", chroma.NameClass: "#FF1010", chroma.NameNamespace: "#FF1010", chroma.NameException: "#D2413A", chroma.NameVariable: "#032F62", chroma.NameConstant: "#032F62", chroma.NameLabel: "#A0A000", chroma.NameEntity: "#999999", chroma.NameAttribute: "#7D9029", chroma.NameTag: "#032F62", chroma.NameDecorator: "#AA22FF", chroma.String: "#0E6200", chroma.StringDoc: "italic", chroma.StringInterpol: "#0E6200", chroma.StringEscape: "#0E6266", chroma.StringRegex: "#0E6233", chroma.StringSymbol: "#19177C", chroma.StringOther: "#032F62", chroma.Number: "#450099", chroma.GenericHeading: "#000080", chroma.GenericSubheading: "#800080", chroma.GenericDeleted: "#A00000", chroma.GenericInserted: "#00A000", chroma.GenericError: "#FF0000", chroma.GenericEmph: "italic", chroma.GenericStrong: "nobold", chroma.GenericPrompt: "#000080", chroma.GenericOutput: "#888", chroma.GenericTraceback: "#04D", chroma.GenericUnderline: "underline", chroma.Error: "border:#FF0000", }))
Hfmrow default theme.
Functions ¶
This section is empty.
Types ¶
type ChromaHighlight ¶
type ChromaHighlight struct { Styles []string Lexers []string Output []byte TextTagList map[string]*gtk.TextTag // Used to store list of used tags in textBuffer Formatter int // contains filtered or unexported fields }
ChromaHighlight: structure, see below for information
func ChromaHighlightNew ¶
func ChromaHighlightNew(buff interface{}, formatter ...int) (c *ChromaHighlight, err error)
TODO rewrite with new bench ... !!! (1) - (0) - (2) ChromaHighlightNew: Syntax highlighter using Chroma syntax highlighter, "github.com/alecthomas/chroma" there is three way to highlight using (0), (1), (2) formatters: (0)- Use the Tags insetion method, all is done in one step and TextBuffer is directly filled after the TextTag creation process. No need to use ToTextBuff() method ! (1)- Used as default, is a three steps method, the first pass collect the visual information, the second pass compile them and the 3rd pass build the TextTags and display to textBuffer using TextBuffer rich text format' implementation, adventage of this method, is that you can save the result to a file that it will be reused later. You must use ToTextBuff() method to display result in TextView, or get the content of the Output variable' struct. (2)- The pango version use TextBuffer. InsertMarkup function, is a two steps method and need more processing time, as previous, you can save result for further usage, and also use output in all component that have Markup capabilities ("tooltips", "label", "treeview", ...). You must use ToTextBuff() method to display result in TextView/SourceView, or the Output variable' struct. Each of them give the same visual result. Bench say approximatly: (0) 6.92 x faster than (2), (1) 10,46 x faster than (2). With a Golang' source file 290K with "hfmrow" style using an old 4*core celeron 2.2ghz.
func (*ChromaHighlight) ClrBuffer ¶
func (c *ChromaHighlight) ClrBuffer()
ClrBuffer:Clear TextBuffer or SourceBuffer
func (*ChromaHighlight) Highlight ¶
func (c *ChromaHighlight) Highlight(inputString, lexerName, styleName string) (err error)
Highlight: Doing the job and Let there be more light ... like a pig on the wings.
func (*ChromaHighlight) Initialised ¶
func (c *ChromaHighlight) Initialised() bool
Initialised: return initialisation state
func (*ChromaHighlight) RemoveTags ¶
func (c *ChromaHighlight) RemoveTags()
RemoveTags: reset all tags and maps
func (*ChromaHighlight) ToFile ¶
func (c *ChromaHighlight) ToFile(filename string) (err error)
ToFile: output to file, cannot be used with (0).
func (*ChromaHighlight) ToTextBuff ¶
func (c *ChromaHighlight) ToTextBuff() (err error)
ToTextBuff: output to TextBuffer. unified version.