Documentation
¶
Overview ¶
Package docx writes Markdown as a Word document (.docx, Office Open XML) in pure Go, for Export as Word, the export_docx tool and /export (spec_filetools_006 FS-75): GitHub-flavoured Markdown parsed by goldmark, written as WordprocessingML with Word's own heading, list, quote, code and table styles, so the navigation pane, a table of contents and restyling work as in any Word document. Links stay links (to a heading too), local pictures are embedded (SVG too, and a lone HTML <img>), maths becomes Word equations, other raw HTML is skipped, and Mermaid diagrams are kept as their source.
Index ¶
Constants ¶
const ( A4 = "A4" Letter = "Letter" )
Page sizes.
Variables ¶
var ErrNotText = errors.New("not a text file")
ErrNotText is returned for input that isn't text.
Functions ¶
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
// writes 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
// Diagram returns a picture of a fenced block's diagram (a “`mermaid
// block, by its text), and its width in pixels; ok false keeps the
// block as its code. nil: every diagram stays code.
Diagram func(lang, source string) (png []byte, width int, ok bool)
}
Options shape a document.