docgen

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package docgen contains helpers for generated project documentation.

The package renders source-readable Markdown tables and normalizes existing GitHub-flavored Markdown pipe tables while preserving fenced code blocks, escaped pipe characters, inline code spans, Unicode cell widths, and original line endings. Command packages use these helpers when refreshing README and docs content so generated files stay stable in diffs and easy to review as plain text.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMarkdownTables

func FormatMarkdownTables(content string) (string, bool)

FormatMarkdownTables normalizes GitHub-flavored Markdown pipe tables in content. Tables inside fenced code blocks are left unchanged.

func RenderMarkdownTable

func RenderMarkdownTable(headers []string, alignments []Alignment, rows [][]string) string

RenderMarkdownTable returns a Markdown table padded to the widest cell in each column so the generated source remains readable as plain text.

Types

type Alignment

type Alignment int

Alignment controls how a Markdown table column is padded and marked.

const (
	// AlignLeft pads cells on the right and uses the default Markdown separator.
	AlignLeft Alignment = iota
	// AlignRight pads cells on the left and uses a right-aligned separator.
	AlignRight
	// AlignCenter pads cells on both sides and uses a centered separator.
	AlignCenter
)

Jump to

Keyboard shortcuts

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