markdown

package
v0.0.0-...-7251fdc Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMarkdownPrint

func BuildMarkdownPrint(filePath string, imageThreshold int) ([]byte, error)

BuildMarkdownPrint parses a markdown file and generates ESC/POS output

func NewBarcodeExtension

func NewBarcodeExtension() goldmark.Extender

NewBarcodeExtension creates a new BarcodeExtension

func NewBarcodeParser

func NewBarcodeParser() parser.BlockParser

NewBarcodeParser creates a new BarcodeParser

Types

type BarcodeBlock

type BarcodeBlock struct {
	ast.BaseBlock
	BarcodeType BarcodeType
	Data        string
}

BarcodeBlock is an AST node for barcode code blocks

func NewBarcodeBlock

func NewBarcodeBlock(barcodeType BarcodeType, data string) *BarcodeBlock

NewBarcodeBlock creates a new BarcodeBlock node

func (*BarcodeBlock) Dump

func (n *BarcodeBlock) Dump(source []byte, level int)

Dump implements Node.Dump

func (*BarcodeBlock) Kind

func (n *BarcodeBlock) Kind() ast.NodeKind

Kind implements Node.Kind

type BarcodeExtension

type BarcodeExtension struct{}

BarcodeExtension is a Goldmark extension for barcode blocks

func (*BarcodeExtension) Extend

func (e *BarcodeExtension) Extend(m goldmark.Markdown)

Extend extends the Goldmark parser

type BarcodeParser

type BarcodeParser struct{}

BarcodeParser parses barcode code blocks

func (*BarcodeParser) CanAcceptIndentedLine

func (b *BarcodeParser) CanAcceptIndentedLine() bool

CanAcceptIndentedLine returns true if this parser can accept indented lines

func (*BarcodeParser) CanInterruptParagraph

func (b *BarcodeParser) CanInterruptParagraph() bool

CanInterruptParagraph returns true if this parser can interrupt a paragraph

func (*BarcodeParser) Close

func (b *BarcodeParser) Close(node ast.Node, reader text.Reader, pc parser.Context)

Close finalizes the block

func (*BarcodeParser) Continue

func (b *BarcodeParser) Continue(node ast.Node, reader text.Reader, pc parser.Context) parser.State

Continue continues parsing

func (*BarcodeParser) Open

func (b *BarcodeParser) Open(parent ast.Node, reader text.Reader, pc parser.Context) (ast.Node, parser.State)

Open tries to open a new barcode block

func (*BarcodeParser) Trigger

func (b *BarcodeParser) Trigger() []byte

Trigger returns characters that trigger this parser

type BarcodeType

type BarcodeType int

BarcodeType represents the type of barcode

const (
	BarcodeQR BarcodeType = iota
	BarcodePDF417
	BarcodeDataMatrix
	BarcodeEAN13
)

type ESCPOSRenderer

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

ESCPOSRenderer renders Goldmark AST to ESC/POS commands

func NewESCPOSRenderer

func NewESCPOSRenderer(markdownDir string, threshold int) *ESCPOSRenderer

NewESCPOSRenderer creates a new ESCPOSRenderer

func (*ESCPOSRenderer) AddOptions

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

AddOptions adds renderer options (required by renderer.Renderer interface)

func (*ESCPOSRenderer) Render

func (r *ESCPOSRenderer) Render(w util.BufWriter, source []byte, node ast.Node) error

Render renders the AST to ESC/POS

type TableRenderer

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

TableRenderer handles table rendering for thermal printers

func NewTableRenderer

func NewTableRenderer() *TableRenderer

NewTableRenderer creates a new TableRenderer

func (*TableRenderer) ExtractTableData

func (tr *TableRenderer) ExtractTableData(table *extast.Table, source []byte)

ExtractTableData extracts table data from AST

func (*TableRenderer) Render

func (tr *TableRenderer) Render() []byte

Render renders the table to ESC/POS

Jump to

Keyboard shortcuts

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