Skip to content

馃悰 fix: render list or multi-paragraph help under the option - #354

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:help-nodes
Aug 27, 2026
Merged

馃悰 fix: render list or multi-paragraph help under the option#354
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:help-nodes

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

help=" " crashed the build with IndexError: list index out of range: the string is truthy, nested_parse yields no nodes, and the code indexed temp.children[0]. Help that parses into something other than a paragraph, such as a bullet list or two paragraphs under RawTextHelpFormatter, landed inside the option's <p>, which puts <li> inside <p> and drops every paragraph after the first. 馃悰 An empty :description: override also left a bare <p></p> in the page.

The option line now takes only a leading paragraph inline after the - separator; any remaining nodes, or all of them when the first is not a paragraph, become blocks under the list item, and _protect_option_dashes runs over the whole item so --flags in those blocks keep their dashes. _pre_format treats a blank block the same as a missing one.

The text builder output for an empty description or epilog loses one blank line; the two exact-output tests reflect that.

@gaborbernat gaborbernat added the bug Something isn't working label Aug 27, 2026
@gaborbernat
gaborbernat force-pushed the help-nodes branch 6 times, most recently from 107041a to eb0ff9d Compare August 27, 2026 16:24
Whitespace-only help crashed with IndexError because nested_parse
returned no nodes and the code indexed the first one. Help that parsed
to a bullet list or several paragraphs got spliced into the option's
paragraph, which nests <li> inside <p> and drops every paragraph after
the first. An empty :description: override left an empty <p>.

Only a leading paragraph now shares the option line; other nodes go
under the list item as blocks, and blank description or epilog text
renders nothing.
@gaborbernat
gaborbernat merged commit b44045b into tox-dev:main Aug 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant