Skip to content

✨ Make epilog formatting consistent with other parts of the help string - #1405

Merged
tiangolo merged 5 commits into
fastapi:masterfrom
svlandeg:fix/epilog
Aug 3, 2026
Merged

✨ Make epilog formatting consistent with other parts of the help string#1405
tiangolo merged 5 commits into
fastapi:masterfrom
svlandeg:fix/epilog

Conversation

@svlandeg

@svlandeg svlandeg commented Nov 12, 2025

Copy link
Copy Markdown
Member

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

@travishathaway travishathaway left a comment

Copy link
Copy Markdown

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
Copy Markdown

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

@svlandeg svlandeg left a comment

Copy link
Copy Markdown
Member Author

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
@medecau

medecau commented May 17, 2026

Copy link
Copy Markdown

@tiangolo can we get this pull-request merged?

🙏🏼 thank you!

@EnigmaticCypher

Copy link
Copy Markdown

@tiangolo I'm aware you're very busy, but this is a really minor fix that will mean I can stop maintaining a separate fork of typer that includes this fix. If you could please merge this I would be most grateful 😄

@tiangolo tiangolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @svlandeg for the fix (and the ping 😅 )!

And thanks everyone for the discussion and confirmation this works.

This will be available in Typer 0.27.1 in the next few hours. 🎉

@tiangolo
tiangolo merged commit ac3efd5 into fastapi:master Aug 3, 2026
22 checks passed
@svlandeg
svlandeg deleted the fix/epilog branch August 3, 2026 14:52
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.

5 participants