Documentation
¶
Index ¶
- func BuildMarkdownPrint(filePath string, imageThreshold int) ([]byte, error)
- func NewBarcodeExtension() goldmark.Extender
- func NewBarcodeParser() parser.BlockParser
- type BarcodeBlock
- type BarcodeExtension
- type BarcodeParser
- func (b *BarcodeParser) CanAcceptIndentedLine() bool
- func (b *BarcodeParser) CanInterruptParagraph() bool
- func (b *BarcodeParser) Close(node ast.Node, reader text.Reader, pc parser.Context)
- func (b *BarcodeParser) Continue(node ast.Node, reader text.Reader, pc parser.Context) parser.State
- func (b *BarcodeParser) Open(parent ast.Node, reader text.Reader, pc parser.Context) (ast.Node, parser.State)
- func (b *BarcodeParser) Trigger() []byte
- type BarcodeType
- type ESCPOSRenderer
- type TableRenderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildMarkdownPrint ¶
BuildMarkdownPrint parses a markdown file and generates ESC/POS output
func NewBarcodeExtension ¶
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
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) 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)
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