renderer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package renderer provides deterministic Markdown rendering for changelogs.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPreset = errors.New("invalid preset")

ErrInvalidPreset is returned when an invalid options preset name is provided.

Functions

func RenderMarkdown

func RenderMarkdown(cl *changelog.Changelog) string

RenderMarkdown renders a changelog to Keep a Changelog formatted Markdown. The output is deterministic: same input always produces identical output.

func RenderMarkdownWithOptions

func RenderMarkdownWithOptions(cl *changelog.Changelog, opts Options) string

RenderMarkdownWithOptions renders a changelog with custom options.

Types

type Config added in v0.4.0

type Config struct {
	Preset  string // default, minimal, full, core, standard
	MaxTier string // optional tier override
}

Config holds configuration for rendering options.

type Options

type Options struct {
	// IncludeReferences includes issue/PR links in entries.
	IncludeReferences bool

	// IncludeCommits includes commit SHAs in references.
	IncludeCommits bool

	// IncludeSecurityMetadata includes CVE/GHSA/severity in security entries.
	IncludeSecurityMetadata bool

	// MarkBreakingChanges prefixes breaking changes with **BREAKING:**.
	MarkBreakingChanges bool

	// IncludeCompareLinks adds version comparison links at the bottom.
	IncludeCompareLinks bool

	// MaxTier filters change types to include only those at or above this tier.
	// Default is TierOptional (include all).
	MaxTier changelog.Tier
}

Options controls how the Markdown is rendered.

func CoreOptions added in v0.4.0

func CoreOptions() Options

CoreOptions returns options for KACL-compliant core output.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns the default rendering options.

func FullOptions

func FullOptions() Options

FullOptions returns options for maximum detail.

func MinimalOptions

func MinimalOptions() Options

MinimalOptions returns options for minimal output.

func OptionsFromConfig added in v0.4.0

func OptionsFromConfig(cfg Config) (Options, error)

OptionsFromConfig creates Options from a Config struct. It first applies the preset, then overrides MaxTier if specified.

func OptionsFromPreset added in v0.4.0

func OptionsFromPreset(preset string) (Options, error)

OptionsFromPreset returns options for the given preset name. Valid presets are: default, minimal, full, core, standard.

func StandardOptions added in v0.4.0

func StandardOptions() Options

StandardOptions returns options including standard tier types.

func (Options) WithMaxTier added in v0.4.0

func (o Options) WithMaxTier(tier changelog.Tier) Options

WithMaxTier returns a copy of the options with the MaxTier field set.

Jump to

Keyboard shortcuts

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