v0.1.10
Patch release for the rendering-helper and scalar-appendix work merged after v0.1.9.
Added
- Added the public
treerenderpackage for generic ASCII tree rendering.- Provides
Render,RenderTree, andRenderTreeWithOptions. - Provides
DefaultStyleandCompactStyle. - Supports wrapping through
RenderOptions.WrapWidth. - Supports continuation indentation modes including fixed-prefix and anchor-based hanging indentation.
- Exposes
Row.Text,Row.TreePartLines,PrefixMetrics, and related helpers for callers that need stable tree-prefix handling.
- Provides
- Added the public
asciitablepackage for aligned table and appendix rendering.- Provides
RenderTablewith typedTableSpecandColumndefinitions. - Provides
RenderAppendixwith typedAppendixSpecdefinitions. - Supports left, right, and center alignment.
- Preserves multiline table cells without wrapping them unexpectedly.
- Provides
- Added
examples/pgexplainjson, a dependency-free PostgreSQLEXPLAIN (ANALYZE, FORMAT JSON)renderer that demonstrates the generictreerenderandasciitablehelpers.- Supports compact tree output.
- Supports total-width wrapping.
- Generates preorder IDs for PostgreSQL plans, which do not provide stable plan-node IDs.
- Added scalar child-link accessors and documentation in
plantree.RowWithPredicates.TreePartLinesexposes tree prefixes as one line per rendered node-text line.RowWithPredicates.ScalarChildLinkspreserves scalar child links in originalPlanNode.ChildLinksorder.ScalarChildLinkcarries child index, type, variable, description, and the scalar child node.RowWithPredicates.KeysandRowWithPredicates.ChildLinksremain populated as compatibility mirrors.
- Added scalar appendix controls to
cmd/rendertree.--print=predicates,ordering,aggregateselects semantic appendix sections.--print=typedprints all typed scalar links as a raw debug dump.--print=fullprints all scalar links, including unnamed links, as a raw debug dump.--print=""suppresses appendix output.--show-varsshows scalar assignment variable names.--resolve-varsresolves direct scalar variable aliases.--resolve-vars-recursiverecursively expands scalar variable aliases for investigation.
- Added scalar appendix controls to
plantree/reference.- Added
PrintSection,PrintSections,ParsePrintSection, andParsePrintSections. - Added
WithPrintSections,WithShowScalarVars,WithResolveScalarVars, andWithResolveScalarVarsRecursive. - Extended
RenderConfigwithPrintSections,ShowScalarVars,ResolveScalarVars, andResolveScalarVarsRecursive. RenderConfig.PrintSectionsdistinguishes omitted/null config from an explicit empty list, so JSON[]can intentionally suppress appendices.
- Added
- Added the shared internal
internal/scalarappendixpackage used by bothcmd/rendertreeandplantree/reference.- Centralizes scalar appendix parsing, validation, rendering, and scalar variable resolution.
- Keeps public packages as facades rather than exposing internal symbols.
- Added Gemini review style-guide guidance to avoid readability-reducing micro-optimizations and to treat JSON tags as API design choices.
Changed
cmd/rendertreenow reuses the shared scalar appendix implementation instead of carrying its own separate section parsing and rendering logic.plantree/referencenow renders appendices through the shared scalar appendix implementation.asciitableappendix rendering was generalized beyond predicates throughAppendixSpecandRenderAppendix.treerenderis now public instead of only being available under an internal package.- The unreleased predicate-specific
asciitablecompatibility API from the development branch was replaced by the more general appendix API before release. treerenderhanging-indent validation now requiresGetContinuationAnchoronly when wrapping is active.- The golangci-lint GitHub Actions workflow is pinned to a concrete v2 release.
- Local review scratch files are ignored by git.
Fixed
WithHangingIndentandRenderConfig{HangingIndent: true}no longer fail when no wrap width is configured; without wrapping, hanging indent is a no-op.- Empty print-section strings now parse as an explicit empty section list, allowing callers to suppress appendix output.
- Scalar appendix JSON config preserves explicit empty
printSectionsslices while still treating omitted/null as the default predicate appendix.
Merged PRs
- #39:
feat: expose generic render helpers - #40:
feat: add scalar appendix sections - #41:
refactor: share scalar appendix rendering
Validation
go test ./...mise x -- golangci-lint run --timeout=5mgit diff --check v0.1.9..origin/main