internal

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package internal contains common API functions and structures shared between lexer packages.

Index

Constants

This section is empty.

Variables

View Source
var Fallback zdpgo_pygments.Lexer = zdpgo_pygments.MustNewLazyLexer(&zdpgo_pygments.Config{
	Name:      "fallback",
	Filenames: []string{"*"},
}, PlaintextRules)

Fallback lexer if no other is found.

View Source
var Registry = struct {
	Lexers  zdpgo_pygments.Lexers
	byName  map[string]zdpgo_pygments.Lexer
	byAlias map[string]zdpgo_pygments.Lexer
}{
	// contains filtered or unexported fields
}

Registry of Lexers.

Functions

func Analyse

func Analyse(text string) zdpgo_pygments.Lexer

Analyse text content and return the "best" lexer..

func Get

func Get(name string) zdpgo_pygments.Lexer

Get a Lexer by name, alias or file extension.

func Match

func Match(filename string) zdpgo_pygments.Lexer

Match returns the first lexer matching filename.

func MatchMimeType

func MatchMimeType(mimeType string) zdpgo_pygments.Lexer

MatchMimeType attempts to find a lexer for the given MIME type.

func Names

func Names(withAliases bool) []string

Names of all lexers, optionally including aliases.

func PlaintextRules

func PlaintextRules() zdpgo_pygments.Rules

PlaintextRules is used for the fallback lexer as well as the explicit plaintext lexer.

func Register

func Register(lexer zdpgo_pygments.Lexer) zdpgo_pygments.Lexer

Register a Lexer with the global registry.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL