Documentation ¶
Overview ¶
Package chroma provides a basic plugin for implementing syntax highlighting using Chroma (https://github.com/alecthomas/chroma).
To use this plugin, pass `--plugin github.com/vito/booklit/chroma/plugin` and use it like so:
\use-plugin{chroma} \syntax{go}{{{ package chroma // ... }}}
An optional style name may be specified as the third argument. To use a custom style you may write your own plugin that embeds this plugin, or re-assign github.com/alecthomas/chroma/styles.Fallback to change the default.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Booklit = lexers.Register(MustNewLexer( &Config{ Name: "Booklit", Aliases: []string{"booklit"}, Filenames: []string{"*.lit"}, MimeTypes: []string{"text/x-booklit"}, }, Rules{ "root": { {`[^\\{}]+`, Text, nil}, {`\{\{\{`, StringDouble, Push("verbatim")}, {`\{-`, CommentMultiline, Push("comment")}, {`[{}]`, NameBuiltin, nil}, {`\\([a-z-]+)`, Keyword, nil}, {`\\[\\{}]+`, Text, nil}, }, "verbatim": { {`\}\}\}`, StringDouble, Pop(1)}, {`[^}]+`, StringDouble, nil}, {`}[^\}]`, StringDouble, nil}, }, "comment": { {`[^-{}]+`, CommentMultiline, nil}, {`\{-`, CommentMultiline, Push()}, {`-\}`, CommentMultiline, Pop(1)}, {`[-{}]`, CommentMultiline, nil}, }, }, ))
Booklit is a lexer for Booklit syntax.
Functions ¶
Types ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
type Transformer ¶ added in v0.12.0
func (Transformer) TransformAll ¶ added in v0.12.0
func (t Transformer) TransformAll(str string) booklit.Sequence
Click to show internal directories.
Click to hide internal directories.