gemrender

package
v0.0.0-...-733fe4d Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Custom

type Custom interface {
	Write(w io.Writer, l gemtext.Line, r LineReader) error
}

Custom defines a custom unit

type Formatter

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

func NewFormatter

func NewFormatter(fc FormatterConf) (*Formatter, error)

NewFormatter returns a new gemtext renderer

probably sounds a bit pointless to have a gemtext > gemtext renderer but its not quite as pointless as it sounds when used with custom line types

func (*Formatter) FormatString

func (f *Formatter) FormatString(r gemtext.LineReader) (string, error)

FormatString writes a parsed file back into gemtext returning a string See FormatWriter for more documentation

func (*Formatter) FormatWriter

func (f *Formatter) FormatWriter(r gemtext.LineReader, w io.Writer) error

FormatWriter writes a parsed file back into gemtext the html header, footer, and stylesheets is left up to the caller to handle

type FormatterConf

type FormatterConf struct {
	CustomTypes  map[string]Custom
	BuiltinTypes map[gemtext.LineType]Custom
}

type LineReader

type LineReader interface {
	Current() gemtext.Line
	Peek(i int) gemtext.Line
	PeekBack() gemtext.Line
	PeekAhead() gemtext.Line
}

LineReader is a linereader but somewhat more restricted

Jump to

Keyboard shortcuts

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