help: colorize the plain backend (headings/names/values/examples) - #396
Merged
Conversation
…reen examples)
Reuse xff/color's auto/always/never resolution at the CLI boundary
(color::Enabled(ResolveWhen(args), isatty, NO_COLOR)) and thread the
resolved bool through HelpRenderContext into the plain backend.
Palette (color on): section/subsection headings bold, flag/primary entry
terms bold-cyan, value-table terms cyan, verbatim example/command blocks
green. Color off renders byte-for-byte as before (guarded by a test).
Make WrapText ANSI-aware (VisibleWidth skips CSI escapes) so colored words
and indents wrap by their on-screen width, then unify plain EmitRows on
WrapText - dropping the now-dead RenderDocRows from help.{h,cc} and the
help.h include/dep from the plain backend.
XFF.md is unaffected (color is plain-only; the markdown backend renders
with color off).
helly25
enabled auto-merge (squash)
August 8, 2026 13:48
…pager idea Help / docs rendering section: structured examples, indent-aware width control, and color are all shipped via the EPIC; F (cross-ref/index/ validation) and the HTML backend are parked as infra for unused features. Add a design leaning for a git-style --pager=CMD (auto on a TTY, honor $PAGER, fall back to less -FRX; pairs with help color) under deferred ideas - confirm the default before building.
This was referenced Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds ANSI color to the plain
--helpbackend, the final polish item of the help-model EPIC (#154).What
Reuses
xff/color's resolution at the CLI boundary -color::Enabled(color::ResolveWhen(args), isatty(STDOUT), NO_COLOR)- so help color honors--color=auto|always|never(bare--color= always) andNO_COLOR, exactly like file-type colors. The resolved bool threads throughHelpRenderContextinto the plain backend.Palette (color on):
Color off renders byte-for-byte as before (guarded by a test), so
--man,--markdown, and piped--helpare unchanged. XFF.md is unaffected (the markdown backend renders with color off).How
WrapTextis now ANSI-aware: a newVisibleWidth()skips CSI escape sequences, so colored words and indents wrap by their on-screen width, not their byte length. With that in place, the plainEmitRowsunifies onWrapText(width 0 = verbatim aligned, width>0 = wrapped) and colors the term column, which let the now-deadRenderDocRowsdrop out ofhelp.{h,cc}(and its include/dep out of the plain backend).Tests
wrap_test: two ANSI-width cases (escapes are zero-width in both content and indent budgets).help_render_test: the full reference emits every palette code with color on, and zero escapes with color off.bazel test //xff/...(85 + 5 skips) and--config=xff_full(90, incl. the XFF.md drift guard) green.