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

This comment was marked as resolved.

@github-actions github-actions bot added the conflicts Automatically generated when a PR has a merge conflict label Dec 19, 2025
@svlandeg svlandeg self-assigned this Jan 7, 2026
@svlandeg svlandeg marked this pull request as draft January 7, 2026 14:16
@github-actions github-actions bot removed the conflicts Automatically generated when a PR has a merge conflict label Jan 7, 2026
Copy link
Member Author

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

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

The code could further be simplified after #1304 has been merged. This is again good to review.

@svlandeg svlandeg marked this pull request as ready for review January 7, 2026 15:46
@svlandeg svlandeg removed their assignment Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature, enhancement or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants