Documentation ¶
Overview ¶
Package cmt provides functions that parse and render GIR comments into nice and conventional Go comments.
Index ¶
- Constants
- func EnsureInfoFields(v interface{}) struct{}
- func GoDoc(v interface{}, indentLvl int, opts ...Option) string
- func ReflowLinesIndent(indentLvl int, cmt string, opts ...Option) string
- func Synopsis(v interface{}, indentLvl int, opts ...Option) string
- type InfoFields
- type Option
- type ParamDoc
Constants ¶
const ( CommentsColumnLimit = 80 - 3 // account for prefix "// " CommentsTabWidth = 4 )
Variables ¶
This section is empty.
Functions ¶
func EnsureInfoFields ¶
func EnsureInfoFields(v interface{}) struct{}
EnsureInfoFields ensures that the given type contains all fields inside InfoFields.
func GoDoc ¶
GoDoc renders a Go documentation string from the given struct. The struct should contain at least the field Name, InfoAttrs and InfoElements.
func ReflowLinesIndent ¶
ReflowLinesIndent reflows the given cmt paragraphs into idiomatic Go comment strings. It is automatically indented.
Types ¶
type InfoFields ¶
type InfoFields struct { Name *string Attrs *gir.InfoAttrs Elements *gir.InfoElements ParamDocs []ParamDoc ReturnDocs []ParamDoc }
InfoFields contains common fields that a GIR schema type may contain. These fields should rarely be used, because they're too magical. All fields inside InfoFields are optional.
func GetInfoFields ¶
func GetInfoFields(v interface{}) InfoFields
GetInfoFields gets the InfoFields from the given value.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option defines possible options for GoDoc.
func AdditionalPrefix ¶ added in v0.0.2
AdditionalPrefix adds the given prefix string into the head of the comment.
func AdditionalString ¶
AdditionalString adds the given string into the tail of the comment as another paragraph.
func OverrideSelfName ¶
OverrideSelfName overrides the Go type name that's implicitly converted automatically by GoDoc.
func ParagraphIndent ¶ added in v0.0.2
ParagraphIndent indents the inner comment paragraphs.
func TrailingNewLine ¶
func TrailingNewLine() Option
TrailingNewLine adds a trailing new line during documentation generation.