First Check
Commit to Help
Example Code
import typer
app = typer.Typer(rich_markup_mode="markdown", name="tester-app")
@app.command(name="tester-cmd", help="""
Header
Line 1
Line 2
Line 3
""")
def cmd():
pass
if __name__ == "__main__":
app()
Description
- Create the typer application as above
- Run this application with
--help switch
- Lines are not properly formatted (they don't start from a newline):
Input:
> tester-app tester-cmd --help
Output:
Usage: dbx tester-cmd [OPTIONS]
Header
Line 1 Line 2 Line 3
Expected output:
Header
Line 1
Line 2
Line 3
If I run the same command with: app = typer.Typer(rich_markup_mode="rich", name="tester-app")
I get the expected result:
Header
Line 1
Line 2
Line 3
If I add more newlines in markdown mode, I get the following:
Input:
@app.command(name="tester-cmd", help="""
Header
Line 1
Line 2
Line 3
""")
def cmd():
pass
Output:
Header
Line 1 Line 2 Line 3
It only works if I add 3 newlines:
Input:
@app.command(name="tester-cmd", help="""
Header
Line 1
Line 2
Line 3
""")
def cmd():
pass
Output:
Header
Line 1
Line 2
Line 3
But it's also not the desired output. Desired output would be something similar to rich formatting:
Header
Line 1
Line 2
Line 3
Operating System
macOS
Operating System Details
Apple M1, macOs Monterey 12.2.1
Typer Version
0.6.1
Python Version
Python 3.9.12
Additional Context
No response
First Check
Commit to Help
Example Code
Description
--helpswitchInput:
Output:
Expected output:
If I run the same command with:
app = typer.Typer(rich_markup_mode="rich", name="tester-app")I get the expected result:
If I add more newlines in
markdown mode, I get the following:Input:
Output:
It only works if I add 3 newlines:
Input:
Output:
But it's also not the desired output. Desired output would be something similar to
richformatting:Operating System
macOS
Operating System Details
Apple M1, macOs Monterey 12.2.1
Typer Version
0.6.1
Python Version
Python 3.9.12
Additional Context
No response