Documentation
¶
Overview ¶
Package report turns a run into a file to share: the printed markdown, a standalone HTML page or a PDF. The CLI's --pdf and --html and the GUI's Report dialog both use it, so they make the same reports.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Formats = []Format{PDF, HTML, Markdown}
Formats lists every format, in the order a menu shows them.
Functions ¶
Types ¶
type Command ¶ added in v1.3.0
type Command struct {
// File is the document, and Dest the report to write.
File, Dest string
Format Format
HideCode bool
HideOutput bool
// Run says the report comes from running the blocks. Otherwise it is
// of the file as saved, like mdsh -n.
Run bool
// Args, Only, Step and StopOnError are the run's options, shown when
// Run is set.
Args []string
Only string
Step bool
StopOnError bool
// Home is the user's home folder, for ~/ paths. Empty names no path
// that way.
Home string
}
Command describes a report as an mdsh command line, so the GUI's Report dialog and the TUI's report form can show how to make the same report from a shell.
type Format ¶
type Format string
Format is a kind of report.
const ( // Markdown is what mdsh prints: placeholders as values, mdsh:if // sections decided, and no #! line. It is what mdsh -n -o saves. Markdown Format = "markdown" // HTML is a standalone page, with local images inside it. HTML Format = "html" // PDF is what mdsh --pdf writes. PDF Format = "pdf" )
type Options ¶
type Options struct {
Format Format
// HideCode leaves out runnable blocks, as --hide-code does.
HideCode bool
// HideOutput leaves out output, as --hide-output does.
HideOutput bool
// Env is the caller's environment, for {{$VAR}} placeholders and
// conditions; see render.Options.
Env []string
// Dir is where relative image links are read from, for HTML and
// PDF. Empty means the working directory.
Dir string
// AllowOutside reads images from anywhere, as mdsh --allow-outside
// does. Otherwise a local image must be inside Dir's root: see
// package docroot.
AllowOutside bool
// Title is the report's title. Empty means none for a PDF and
// "mdsh report" for an HTML page.
Title string
// ShowSecrets prints blocks marked secret as they are. Otherwise
// their code and output are "(secret)": a report is made to be read
// by others (see render.Options.MaskSecrets).
ShowSecrets bool
}
Options control what a report shows.