syntax

package
v0.0.0-...-dd6dd12 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package syntax contains components to perform syntax highlighting

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeBlock

type CodeBlock struct {
	Lang  string
	Block *bytes.Buffer
}

CodeBlock is a ``` fenced block of code that will be syntax highlighted

func NewCodeBlock

func NewCodeBlock() CodeBlock

func (CodeBlock) Content

func (code CodeBlock) Content() ([]byte, string)

func (CodeBlock) Exists

func (code CodeBlock) Exists() bool

type Highlighter

type Highlighter interface {
	Highlight(text []byte, lang string) ([]byte, error)
}

Highlighter is the interface that syntax highlighters must implement

type Pygmentize

type Pygmentize struct{}

Pygmentize uses the external "pygmentize" command. Pygmentize must be installed on the executing machine: http://pygments.org/ pip install Pygments

func (Pygmentize) Highlight

func (h Pygmentize) Highlight(text []byte, lang string) ([]byte, error)

Jump to

Keyboard shortcuts

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