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 ¶
- func ComputeReplacedSection(text, startMark, endMark, content string) (string, error)
- func FormatMarkdownTables(content string) (string, bool)
- func RenderMarkdownTable(headers []string, alignments []Alignment, rows [][]string) string
- func ReplaceSection(path, startMark, endMark, content string) error
- type Alignment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeReplacedSection ¶
ComputeReplacedSection returns text with the content between startMark and endMark replaced by content. It returns an error when either marker is absent, so callers fail fast instead of writing a malformed file.
func FormatMarkdownTables ¶
FormatMarkdownTables normalizes GitHub-flavored Markdown pipe tables in content. Tables inside fenced code blocks are left unchanged.
func RenderMarkdownTable ¶
RenderMarkdownTable returns a Markdown table padded to the widest cell in each column so the generated source remains readable as plain text.
func ReplaceSection ¶
ReplaceSection rewrites the file at path, replacing the content between startMark and endMark (both preserved) with content. It is used by the generator commands that maintain managed README/doc sections.