Documentation ¶
Overview ¶
Package html renders HTML from godoc.Package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Breadcrumb ¶
type Breadcrumb struct { // Text for the crumb. Text string // Path to the crumb from the root of the output. Path string }
Breadcrumb holds information about parents of a page so that we can leave a trail up for navigation.
type CommentDocPrinter ¶
CommentDocPrinter is a DocPrinter built from a comment.Printer.
func (*CommentDocPrinter) WithHeadingLevel ¶
func (dp *CommentDocPrinter) WithHeadingLevel(lvl int) DocPrinter
WithHeadingLevel returns a copy of this DocPrinter that will generate headers at the specified level.
type DocPrinter ¶
type DocPrinter interface { HTML(*comment.Doc) []byte WithHeadingLevel(int) DocPrinter }
DocPrinter formats godoc comments as HTML.
type Highlighter ¶ added in v0.3.0
Highlighter renders Go code into HTML.
type PackageIndex ¶
type PackageIndex struct { // Path to this package index. Path string NumChildren int Subpackages []Subpackage Breadcrumbs []Breadcrumb }
PackageIndex holds information about a package listing.
func (*PackageIndex) Basename ¶
func (idx *PackageIndex) Basename() string
Basename is the last component of this directory's path, or if it's the top level directory, an empty string.
type PackageInfo ¶
type PackageInfo struct { // Parsed package documentation information. *godoc.Package NumChildren int Subpackages []Subpackage Breadcrumbs []Breadcrumb // DocPrinter specifies how to render godoc comments. DocPrinter DocPrinter }
PackageInfo specifies the package that should be rendered.
func (*PackageInfo) Basename ¶
func (b *PackageInfo) Basename() string
Basename is the last component of this package's path.
type Renderer ¶
type Renderer struct { // Path to the home page of the generated site. Home string // Whether we're in embedded mode. // In this mode, output will only contain the documentation output // and will not generate complete, stylized HTML pages. Embedded bool // Internal specifies whether directory listings // should include internal packages. Internal bool // FrontMatter to include at the top of each file, if any. FrontMatter *ttemplate.Template // Highlighter renders code blocks into HTML. Highlighter Highlighter }
Renderer renders components into HTML.
func (*Renderer) RenderPackage ¶
func (r *Renderer) RenderPackage(w io.Writer, info *PackageInfo) error
RenderPackage renders the documentation for a single Go package. It does not include subpackage information.
func (*Renderer) RenderPackageIndex ¶
func (r *Renderer) RenderPackageIndex(w io.Writer, pidx *PackageIndex) error
RenderPackageIndex renders the list of descendants for a package as HTML.
func (*Renderer) WriteStatic ¶
WriteStatic dumps the contents of static/ into the given directory.
This is a no-op if the renderer is running in embedded mode.
type Subpackage ¶
type Subpackage struct { // RelativePath is the path to the subpackage // relative to the package it's a subpackage of. RelativePath string // Synopsis is a short, one-sentence summary // extracted from the package's documentation. Synopsis string }
Subpackage is a descendant of a Go package.
This is typically a direct descendant, but it may be a couple levels deeper if there are no intermediate Go packages. For example, foo/internal/bar may be a descendant of foo/ if internal is not a Go package.