Documentation
¶
Overview ¶
Package doc implements support for documentation of Gno packages and realms, in a similar fashion to `go doc`. As a reference, the official implementation for `go doc` is used.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Documentable ¶
type Documentable struct {
// contains filtered or unexported fields
}
Documentable is a package, symbol, or accessible which can be documented.
func NewDocumentableFromMemPkg ¶
func NewDocumentableFromMemPkg(memPkg *gnovm.MemPackage, unexported bool, symbol, accessible string) (*Documentable, error)
NewDocumentableFromMemPkg gets the pkgData from memPkg and returns a Documentable
func ResolveDocumentable ¶
func ResolveDocumentable(dirs, modDirs, args []string, unexported bool) (*Documentable, error)
ResolveDocumentable returns a Documentable from the given arguments. Refer to the documentation of gno doc for the formats accepted (in general the same as the go doc command). An error may be returned even if documentation was resolved in case some packages in dirs could not be parsed correctly.
dirs specifies the gno system directories to scan which specify full import paths in their directories, such as @/examples and @/gnovm/stdlibs; modDirs specifies directories which contain a gno.mod file.
func (*Documentable) WriteDocumentation ¶
func (d *Documentable) WriteDocumentation(w io.Writer, o *WriteDocumentationOptions) error
func (*Documentable) WriteJSONDocumentation ¶
func (d *Documentable) WriteJSONDocumentation() (*JSONDocumentation, error)
WriteJSONDocumentation returns a JSONDocumentation for the package
type JSONDocumentation ¶
type JSONDocumentation struct { PackagePath string `json:"package_path"` PackageLine string `json:"package_line"` // package io // import "io" PackageDoc string `json:"package_doc"` // markdown of top-level package documentation // These match each of the sections in a pkg.go.dev package documentation Values []*JSONValueDecl `json:"values"` // constants and variables declared Funcs []*JSONFunc `json:"funcs"` // Funcs and methods Types []*JSONType `json:"types"` }
JSONDocumentation holds package documentation suitable for transmitting as JSON with printable string fields
func (*JSONDocumentation) JSON ¶
func (jsonDoc *JSONDocumentation) JSON() string
type JSONValueDecl ¶
type WriteDocumentationOptions ¶
type WriteDocumentationOptions struct { // ShowAll shows all symbols when displaying documentation about a package. ShowAll bool // Source shows the source code when documenting a symbol. Source bool // Unexported shows unexported symbols as well as exported. Unexported bool // Short shows a one-line representation for each symbol. Short bool // contains filtered or unexported fields }
WriteDocumentationOptions represents the possible options when requesting documentation through Documentable.