Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProcessFile ¶
ProcessFile reads a Markdown file and produces a PDF.
func ProcessHTMLFile ¶
ProcessHTMLFile reads an HTML file and produces a PDF. Unlike Markdown mode, no default CSS is applied — styling comes from <link>, <style>, inline styles, or the --css flag.
func ProcessHTMLString ¶ added in v0.0.11
ProcessHTMLString takes an HTML payload (already in memory), the directory to resolve relative CSS @import / <link> paths against, and an output PDF filename, and runs the same pipeline as ProcessHTMLFile.
Useful for embedders that produce HTML on the fly (e.g. an XSL-FO walker) and want to skip the disk-roundtrip of writing the HTML out and reading it back in.
Types ¶
type Frontmatter ¶
type Frontmatter struct {
Title string `yaml:"title"`
Author string `yaml:"author"`
CSS string `yaml:"css"`
Papersize string `yaml:"papersize"`
Format string `yaml:"format"`
Lang string `yaml:"lang"`
Extra map[string]any `yaml:"-"` // all key-value pairs (including the known ones)
}
Frontmatter holds metadata extracted from the YAML front matter block.
type Options ¶
type Options struct {
Template bool // apply Go template expansion before processing
CSSFile string // additional CSS file to load
DebugMarkdown bool // print expanded Markdown to stdout instead of generating PDF
DebugHTML bool // print generated HTML to stdout instead of generating PDF
// Format selects a PDF conformance level. "PDF/UA" enables the
// accessibility tagging pipeline (StructTreeRoot, MarkInfo, role-mapped
// element tree, XMP pdfuaid:part 1). Empty means a plain PDF.
Format string
// Lang is the BCP47 language tag written to the PDF catalog (/Lang) and
// used as the document-wide hyphenation default. Required for PDF/UA.
Lang string
// Title becomes the document /Title (catalog + XMP dc:title). PDF/UA
// also auto-enables /DisplayDocTitle so PDF readers show the title in
// the window chrome instead of the filename.
Title string
}
Options controls the Markdown processing pipeline.