Documentation
¶
Overview ¶
Package mdpdf typesets Markdown as a PDF in pure Go, for the export_pdf tool (spec_006_filetools): GitHub-flavoured Markdown parsed by goldmark, laid out with fpdf in embedded Noto fonts, with an outline of the headings, page numbers, tables, highlighted code and the images the caller lets it read. Raw HTML is skipped and Mermaid diagrams print as their code: drawing them needs a browser, which the desktop app's own export has.
Index ¶
Constants ¶
const ( A4 = "A4" Letter = "Letter" )
Page sizes.
Variables ¶
var ErrNotMarkdown = errors.New("not a text file")
ErrNotMarkdown is returned for input that isn't text.
Functions ¶
func PageSizeFor ¶
PageSizeFor resolves a [pdf] page_size setting: "a4", "letter", or "auto" (or empty), which picks Letter where the locale's country uses it.
Types ¶
type Options ¶
type Options struct {
// PageSize is A4 or Letter (default A4).
PageSize string
// Title is the document's title in its properties; default the first
// heading.
Title string
// ReadImage returns the bytes of an image the Markdown refers to, by
// its destination as written (relative to the Markdown file). nil
// prints images as their alt text, as it does for any it can't read.
ReadImage func(dest string) ([]byte, error)
// Time is the document's creation date (default now).
Time time.Time
}
Options shape a document.