renderer

package
v0.0.0-...-71179b8 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HeadingStyle

type HeadingStyle struct {
	FontFamily string
	FontStyle  string
	FontSize   float64

	TextColor *color.Color
	FillColor *color.Color

	Padding    float64
	LeftMargin float64
}

type NodeRendererFunc

type NodeRendererFunc func(w Writer, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)

NodeRendererFunc is a function that renders a given node.

type Renderer

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

Renderer holds all functions to render

func NewRenderer

func NewRenderer() *Renderer

NewRenderer returns new default renderer

func (*Renderer) AddOptions

func (r *Renderer) AddOptions(...renderer.Option)

AddOptions adds given option to this renderer.

func (*Renderer) Register

func (r *Renderer) Register(kind ast.NodeKind, v NodeRendererFunc)

Register a new node render func

func (*Renderer) Render

func (r *Renderer) Render(w io.Writer, source []byte, node ast.Node) error

Render renders a PDF doc

type Styled

type Styled interface {
	NewSetFontStyleOption(string) func(style any) error
	NewAddFontStyleOption(string) func(style any) error
	NewFontFamilyOption(string) func(style any) error
	NewFontSizeOption(float64) func(style any) error

	NewTextColorOption(*color.Color) func(style any) error
	NewFillColorOption(*color.Color) func(style any) error

	NewAddMarginOption(float64) func(style any) error
	NewAddCellMarginOption(float64) func(style any) error
	NewSetCellMarginOption(float64) func(style any) error
	NewPaddingOption(float64) func(style any) error

	WithStyle(...func(style any) error)
	ResetStyle()
}

Styled describes what kind of behaviour we expect from styled elements

type WithBreaks

type WithBreaks interface {
	LineBreak()
	ThematicBreak()
}

WithBreaks describes what kind of behaviour we expect from breaks

type Writer

type Writer interface {
	Write(p []byte) (n int, err error)
	Styled
	WriteImage(string, io.Reader, ...ast.Attribute)
	SetLink(string)
	WriteTable(rows ...[]string)
	WithBreaks
}

Writer describes what kind of behaviour we expect from writer

Jump to

Keyboard shortcuts

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