booklit: github.com/vito/booklit/chroma Index | Files | Directories

package chroma

import "github.com/vito/booklit/chroma"

Index

Package Files

booklit_lexer.go plugin.go

Variables

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 lexer.

func NewPlugin Uses

func NewPlugin(section *booklit.Section) booklit.Plugin

type Plugin Uses

type Plugin struct {
    // contains filtered or unexported fields
}

func (Plugin) Syntax Uses

func (plugin Plugin) Syntax(language string, code booklit.Content, styleName ...string) (booklit.Content, error)

Directories

PathSynopsis
plugin

Package chroma imports 6 packages (graph) and is imported by 1 packages. Updated 2020-07-04. Refresh now. Tools for package owners.