doc

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package doc contains documentation generator.

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingMarker = errors.New("missing marker comment")

ErrMissingMarker returned by Inject when no marker comment was found.

Functions

func FormatStrings

func FormatStrings() []string

FormatStrings returns a slice of all String values of the enum

func Generate

func Generate(mod *idl.Module, options ...Option) ([]byte, error)

Generate generates documentation for the module.

func Inject

func Inject(target []byte, name string, source []byte) ([]byte, error)

Inject insert a text into the target document at the place indicated by the marker with the given name. The beginning of the insertion point is indicated by the line containing only the text "<!-- begin:NAME -->", and the end is indicated by the line containing only the text "<!-- end:NAME -->", where NAME is the name of the marker.

Types

type Format

type Format int

Format describes output formt.

const (
	// FormatUnknown is a Format enum value for unknown format.
	FormatUnknown Format = iota
	// FormatMarkdown is a Format enum value for markdown output format.
	FormatMarkdown
	// FormatHTML is a Format enum value for HTML output format.
	FormatHTML
)

func FormatString

func FormatString(s string) (Format, error)

FormatString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func FormatValues

func FormatValues() []Format

FormatValues returns all values of the enum

func (Format) IsAFormat

func (i Format) IsAFormat() bool

IsAFormat returns "true" if the value is listed in the enum definition. "false" otherwise

func (Format) MarshalJSON

func (i Format) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Format

func (Format) MarshalText

func (i Format) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Format

func (Format) String

func (i Format) String() string

func (*Format) UnmarshalJSON

func (i *Format) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Format

func (*Format) UnmarshalText

func (i *Format) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Format

func (Format) Values

func (Format) Values() []string

type Option

type Option func(*options)

Option defines a documentation generator option function.

func WithFormat

func WithFormat(format Format) Option

WithFormat can be used to specify the output format.

func WithGitHubRepo added in v0.1.2

func WithGitHubRepo(repo string) Option

WithGitHubRepo can be used to specify the GitHub repository in owner/name form.

func WithHeading

func WithHeading(heading uint) Option

WithHeading can be used to specify the initial heading level.

func WithLinkExamples added in v0.1.2

func WithLinkExamples(flag bool) Option

WithLinkExamples can be used to enable/disable examples folder link.

func WithLinkPackages added in v0.1.2

func WithLinkPackages(flag bool) Option

WithLinkPackages can be used to enable/disable GitHub container packages link.

func WithLinkReleases added in v0.1.2

func WithLinkReleases(flag bool) Option

WithLinkReleases can be used to enable/disable GitHub releases link.

func WithOuter

func WithOuter(outer []byte) Option

WithOuter can be used to specify the outer document to update.

func WithTemplate

func WithTemplate(tmpl string) Option

WithTemplate can be used to specify go template source.

func WithTemplateName

func WithTemplateName(name string) Option

WithTemplateName can be used to specify go template name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL