Skip to content

Conversation

@svlandeg
Copy link
Member

@svlandeg svlandeg commented Nov 12, 2025

As discussed in #1400, the formatting of the epilog section of the help text is currently not consistent with the other parts of the help text.

This PR introduces a new private function _fix_linebreaks that has the same functionality as before as part of _get_help_text. It deals with linebreaks depending on the given markup mode. This function is then also used when printing the epilog, ensuring consistency. Only the formatting of the epilog is changed, nothing else.

On master, the new unit test fails both for "markdown" and "rich", as it joins together the first few lines into one big "Just wrapping up: This is the first conclusion Here is conclusion two" line.

@svlandeg svlandeg added the feature New feature, enhancement or request label Nov 12, 2025
@svlandeg svlandeg self-assigned this Nov 12, 2025
@svlandeg svlandeg marked this pull request as ready for review November 12, 2025 15:09
@svlandeg svlandeg removed their assignment Nov 12, 2025
Copy link

@travishathaway travishathaway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a chance to read the original discussion and think this is a perfectly fine solution to this problem.

@EnigmaticCypher
Copy link

This looks like an elegant solution to the problem in my view, and also brings over some behaviour from the help description processing (mainly the usage of \b to indicate that single lines shouldn't be stripped). While the \b thing isn't related to my discussion, it is something I use in a typer CLI tool I maintain at work, so am happy to see that included as well.

Great PR 🚀

I'll rebase my internal fork of typer and include these fixes until @tiangolo merges this PR. The last PR for an issue I was running into took about 1.5 years to get merged into typer master, so I'm hoping this one doesn't take quite that long 😅

@github-actions
Copy link
Contributor

This pull request has a merge conflict that needs to be resolved.

@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts Automatically generated when a PR has a merge conflict feature New feature, enhancement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants