export

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package export serializes a blocks.Document into the output formats gitrakz exposes to callers: raw JSON, CSV, and PDF.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownBlockType = errors.New("unknown block type")

ErrUnknownBlockType is returned when a blocks.Block carries a BlockType this package has no serializer for.

Functions

func ToCSV

func ToCSV(doc blocks.Document) ([]byte, error)

ToCSV walks doc and serializes every tabular block (table, list, keyvalue, metric, chart) into a single CSV document. Prose blocks (heading, text, code) carry no tabular data and are skipped. Records vary in width across block types, so a caller reading the result back with encoding/csv must set csv.Reader.FieldsPerRecord = -1.

func ToJSON

func ToJSON(doc blocks.Document) ([]byte, error)

ToJSON serializes doc as its canonical JSON representation, for piping the block document to another consumer.

func ToPDF

func ToPDF(doc blocks.Document) ([]byte, error)

ToPDF renders every block in doc, in document order, into a single paginated PDF via maroto.

Types

This section is empty.

Jump to

Keyboard shortcuts

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