docs

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderDoc

func RenderDoc(w io.Writer, sections Sections, meta Metadata) error

RenderDoc writes JSON-encoded DocOutput to w. Returns error only if JSON encoding fails (should not happen with these types).

func RenderHelp

func RenderHelp(w io.Writer, sections Sections, meta Metadata) error

RenderHelp writes formatted help text to w. If sections are empty and metadata is zero-value, writes a minimal "no documentation available" message. Returns the first write error encountered.

Types

type DocOutput

type DocOutput struct {
	Short              string   `json:"short"`
	Long               string   `json:"long"`
	Examples           string   `json:"examples"`
	Image              string   `json:"image"`
	Description        string   `json:"description"`
	Tags               []string `json:"tags"`
	SourceURL          string   `json:"sourceURL"`
	ExamplePackageURLs []string `json:"examplePackageURLs"`
	License            string   `json:"license"`
	Hidden             bool     `json:"hidden"`
}

DocOutput is the canonical JSON structure for --doc output. The SDK owns this schema as the single source of truth. Downstream consumers (e.g. catalog Hugo pipeline, metadata-schema.json) validate against a subset of these fields.

type Metadata

type Metadata struct {
	Image              string   `yaml:"image" json:"image"`
	Description        string   `yaml:"description" json:"description"`
	Tags               []string `yaml:"tags" json:"tags"`
	SourceURL          string   `yaml:"sourceURL" json:"sourceURL"`
	ExamplePackageURLs []string `yaml:"examplePackageURLs" json:"examplePackageURLs"`
	License            string   `yaml:"license" json:"license"`
	Hidden             bool     `yaml:"hidden" json:"hidden"`
}

Metadata holds parsed metadata.yaml content.

func ParseMetadata

func ParseMetadata(meta []byte) (Metadata, error)

ParseMetadata parses metadata.yaml content into a Metadata struct. Returns zero-value Metadata and an error if YAML is invalid. Returns successfully with partial fields if optional fields are missing.

type Sections

type Sections struct {
	Short    string
	Long     string
	Examples string
}

Sections holds parsed README marker content.

func ParseMarkers

func ParseMarkers(readme []byte) Sections

ParseMarkers extracts mdtogo marker sections from README content. Missing markers result in empty strings for the corresponding sections. When no markers are present at all, the full content (trimmed) is returned as the Long description.

Jump to

Keyboard shortcuts

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