Skip to content

doc: add word wrap support for Short and Long in generated markdown#2410

Open
FMarcelFC wants to merge 1 commit into
spf13:mainfrom
FMarcelFC:fix/docs-word-wrap
Open

doc: add word wrap support for Short and Long in generated markdown#2410
FMarcelFC wants to merge 1 commit into
spf13:mainfrom
FMarcelFC:fix/docs-word-wrap

Conversation

@FMarcelFC
Copy link
Copy Markdown

@FMarcelFC FMarcelFC commented May 27, 2026

Summary

  • Adds GenMarkdownCustomWithOptions and GenMarkdownTreeCustomWithOptions with a MarkdownOptions struct
  • MarkdownOptions.WrapWidth sets the max line length for Short and Long fields; 0 disables wrapping (fully backward-compatible)
  • cmd.Example is intentionally excluded: it renders inside a Markdown code fence which is always verbatim; wrapping it would corrupt command syntax

Test plan

  • TestGenMdDocWithOptions_NoWrap : WrapWidth=0 produces identical output to GenMarkdownCustom
  • TestGenMdDocWithOptions_WrapWidth : prose lines respect the configured width
  • TestGenMdDocWithOptions_PreservesExistingNewlines : existing \n in text is not re-joined
  • TestGenMdDocWithOptions_MatchesGenMarkdownCustom : output identity with zero options
  • TestGenMdTreeCustomWithOptions : tree variant generates files correctly
  • All existing tests pass (go test ./...)

Closes #2282

Adds GenMarkdownCustomWithOptions and GenMarkdownTreeCustomWithOptions
with a MarkdownOptions.WrapWidth field. WrapWidth=0 preserves existing
behavior. Example is intentionally excluded as it renders in a code fence.

Closes spf13#2282
@github-actions github-actions Bot added the area/docs-generation Generation of docs via Cobra label May 27, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 27, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs-generation Generation of docs via Cobra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Would like to have word wrapping and line breaks in generated md docs

2 participants