Documentation ¶
Overview ¶
Package godocgen parses Go packages and indexes constants, functions and types.
`godocgen` keeps your private Go repositories documented with the same source code & repository.
Index ¶
- func GetSourcePackages(path string) ([]string, error)
- func ToMD(w io.Writer, text string)
- func WriteMDTemplate(idx *PackageIndex, outPath string) error
- func WriteMarkdown(idx *PackageIndex, outPath string) error
- type Blockable
- type Const
- type Content
- type Example
- type Func
- type GoCode
- type Heading1
- type Heading2
- type Heading3
- type Heading4
- type Index
- type IndexEntry
- type Markdown
- type PackageIndex
- type Type
- type Var
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSourcePackages ¶
GetSourcePackages returns all package directories in path excludes vendor directories
func ToMD ¶ added in v0.1.0
ToMD converts comment text to formatted Markdown. The comment was prepared by DocReader, so it is known not to have leading, trailing blank lines nor to have trailing spaces at the end of lines. The comment markers have already been removed.
Each span of unindented non-blank lines is converted into a single paragraph. There is one exception to the rule: a span that consists of a single line, is followed by another paragraph span, begins with a capital letter, and contains no punctuation is formatted as a heading.
A span of indented lines is converted into a pre block, with the common indent prefix removed.
URLs in the comment text are converted into links.
func WriteMDTemplate ¶ added in v0.1.0
func WriteMDTemplate(idx *PackageIndex, outPath string) error
WriteMDTemplate creates a markdown output using an template
func WriteMarkdown ¶
func WriteMarkdown(idx *PackageIndex, outPath string) error
WriteMarkdown writes indexed documents as markdown content
Types ¶
type Blockable ¶
type Blockable interface {
ToString() string
}
Blockable is implement by content blocks
type Example ¶
type Example struct { Name string ForFunc string Suffix string Doc string Snippet string Output string }
Example demonstrates use of functions & types in a package
type Index ¶
type Index []IndexEntry
Index is a list of all labels in the document
type IndexEntry ¶
IndexEntry is an entry that is rendered as a list item
type Markdown ¶
type Markdown struct {
Blocks []Blockable
}
Markdown is a collection of blocks
type PackageIndex ¶
type PackageIndex struct { Name string Dir string Doc string Vars []Var Consts []Const Funcs []Func Types []Type Examples []Example }
PackageIndex contains all parsed types & functions information
func GetPackageIndex ¶
func GetPackageIndex(src string) (*PackageIndex, error)
GetPackageIndex parses and returns all the documentation content in a package