Help us shape the future of Go! Take the 2026 Go Developer Survey

render

package
v0.0.0-...-ddc50a6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package render writes a commit map as text, JSON, SVG or HTML.

Index

Constants

View Source
const (
	SVGMarker  = `class="cm-svg"`
	HTMLMarker = `<p class="credit">commitmap `
)

Markers identify files commitmap wrote, so a caller can tell its own earlier output from someone else's file before replacing it.

Variables

This section is empty.

Functions

func Age

func Age(t int64, now time.Time) string

Age renders how long ago t was, relative to now: 5h, 4d, 3w, 7mo, 2y.

func HTML

func HTML(w io.Writer, r *Report, o HTMLOptions) error

HTML writes a single self-contained page: no external requests, inline SVG diagram, a collapsible tree, light and dark schemes.

func JSON

func JSON(w io.Writer, r *Report) error

JSON writes the report as indented JSON.

func SVG

func SVG(w io.Writer, r *Report, o SVGOptions) error

SVG writes a standalone SVG document.

func Text

func Text(w io.Writer, r *Report, o TextOptions) error

Text writes the tree for a terminal.

Types

type Filters

type Filters struct {
	Since      string   `json:"since,omitempty"`
	Until      string   `json:"until,omitempty"`
	Author     string   `json:"author,omitempty"`
	Paths      []string `json:"paths,omitempty"`
	Min        int      `json:"min,omitempty"`
	Top        int      `json:"top,omitempty"`
	Merges     bool     `json:"merges"`
	IncludeAll bool     `json:"include_all"`
}

Filters echoes the options that shaped the report.

type HTMLOptions

type HTMLOptions struct {
	Now time.Time
	Loc *time.Location
}

HTMLOptions controls the HTML page.

type Report

type Report struct {
	Version        string
	Mode           string
	Rev            string
	Label          string // header label: branch name or rev
	Depth          int    // 0 means unlimited
	Filters        Filters
	Root           *tree.Node
	IgnoredChanges int
	Merges         int // branch mode: merge commits examined
	UnparsedMerges int // branch mode: merges whose subject named no branch
}

Report is everything a renderer needs.

type SVGOptions

type SVGOptions struct {
	Loc *time.Location
}

SVGOptions controls the diagram.

type TextOptions

type TextOptions struct {
	Color bool
	Now   time.Time
	Loc   *time.Location
}

TextOptions controls the terminal tree.

Jump to

Keyboard shortcuts

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