badges

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2025 License: MIT Imports: 5 Imported by: 0

README

badges

Project Badges

go package for generate badges in repositories

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Badge added in v0.0.3

type Badge struct {
	Label string
	Value string
	Color string
}

Badge represents a single badge definition (exported)

type BadgesHandler added in v0.0.3

type BadgesHandler struct {
	// contains filtered or unexported fields
}

func NewBadgeHandler

func NewBadgeHandler(args ...string) *BadgesHandler

NewBadgeHandler creates a new BadgesHandler with defaults and processes args for special commands eg: output_svgfile:docs/img/custom.svg

func (*BadgesHandler) BadgeMarkdown added in v0.0.3

func (h *BadgesHandler) BadgeMarkdown() string

BadgeMarkdown builds the HTML/Markdown snippet that links to the SVG It always uses the handler's configured output file (`outputFile`). Example output: <a href="docs/img/custom.svg"><img src="docs/img/custom.svg" alt="Project Badges" title="Generated by badges package from github.com/cdvelop/devscripts"></a>

func (*BadgesHandler) BuildBadges added in v0.0.3

func (h *BadgesHandler) BuildBadges() ([]string, error)

BuildBadges generates the SVG, writes it to the configured output file, and returns the badge markdown string and an error if any. BuildBadges generates the SVG, writes it to the configured output file, and returns the four arguments required by SectionUpdate as a slice of strings: [sectionID, afterLine, content, readmeFile]

func (*BadgesHandler) Err added in v0.0.3

func (h *BadgesHandler) Err() error

Err returns any initialization or parsing error stored in the handler.

func (*BadgesHandler) GenerateSVG added in v0.0.3

func (h *BadgesHandler) GenerateSVG() ([]byte, int, error)

GenerateSVG runs parsing and generation and returns svg, count, warnings, error Example output (for two badges `License:MIT:blue` and `Go:1.22:blue`):

<?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg"> <!-- Badge: License --> <text>License: MIT</text> <!-- Badge: Go --> <text>Go: 1.22</text> </svg>

func (*BadgesHandler) OutputFile added in v0.0.3

func (h *BadgesHandler) OutputFile() string

OutputFile returns the configured output SVG file path

func (*BadgesHandler) ReadmeFile added in v0.0.3

func (h *BadgesHandler) ReadmeFile() string

ReadmeFile returns the configured README file path

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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