package internal
import "github.com/alecthomas/chroma/lexers/internal"
Package internal contains common API functions and structures shared between lexer packages.
Index ¶
- Variables
- func Analyse(text string) chroma.Lexer
- func Get(name string) chroma.Lexer
- func Match(filename string) chroma.Lexer
- func MatchMimeType(mimeType string) chroma.Lexer
- func Names(withAliases bool) []string
- func PlaintextRules() chroma.Rules
- func Register(lexer chroma.Lexer) chroma.Lexer
Variables ¶
var Fallback chroma.Lexer = chroma.MustNewLazyLexer(&chroma.Config{ Name: "fallback", Filenames: []string{"*"}, }, PlaintextRules)
Fallback lexer if no other is found.
var Registry = struct { Lexers chroma.Lexers byName map[string]chroma.Lexer byAlias map[string]chroma.Lexer }{ // contains filtered or unexported fields }
Registry of Lexers.
Functions ¶
func Analyse ¶
Analyse text content and return the "best" lexer..
func Get ¶
Get a Lexer by name, alias or file extension.
func Match ¶
Match returns the first lexer matching filename.
func MatchMimeType ¶
MatchMimeType attempts to find a lexer for the given MIME type.
func Names ¶
Names of all lexers, optionally including aliases.
func PlaintextRules ¶
PlaintextRules is used for the fallback lexer as well as the explicit plaintext lexer.
func Register ¶
Register a Lexer with the global registry.
Source Files ¶
- Version
- v0.10.0 (latest)
- Published
- Jan 12, 2022
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 6 hours ago –
Tools for package owners.