import "code.pfad.fr/vanitydoc/template"
package template generates documentation for a given package.
Synopsis returns a cleaned version of the first sentence of the documentation
WriteCSS writes the default CSS to the given writer.
Directory represents the sub-packages of a given package.
GemtextRenderer provides the generation of gemtext documentation.
func (gr GemtextRenderer) Execute(out io.Writer, td TemplateData) error
Execute applies a parsed template to the template data, and writes the output to w.
type HTMLRenderer struct { Favicon string Stylesheets []string // AdditionalFS and AdditionalPattern can be optionally provided // to override some components AdditionalFS fs.FS AdditionalPatterns []string BaseURL string DocSite string // defaults to "https://pkg.go.dev" }
HTMLRenderer provides the generation of HTML documentation.
func (hr HTMLRenderer) Execute(out io.Writer, td TemplateData) error
Execute applies a parsed template to the template data, and writes the output to w.
Execute applies a parsed template to the template data, and writes the output to w.
type TemplateData struct { Package *doc.Package FileSet *token.FileSet ModulePath string PackageChain []string Directories []Directory VCS autodiscovery.VCS Ref string }
TemplateData stores all the data needed to render the documentation templates.
func NewTemplateData( ctx build.Context, modulePath string, packageChain []string, directories []Directory, vcs autodiscovery.VCS, ref string, ) (TemplateData, error)
NewTemplateData parses the provided pkgFS to prepare the template data.
func (td TemplateData) AdjustedImportPath() string
AdjustedImportPath removes "std/" prefix (for showing the stdlib).
func (td TemplateData) PageName() string
PageName returns the page name ("*** package" or "*** command" depending on the package name).