fastapi / typer

Typer, build great CLIs. Easy to code. Based on Python type hints.
https://typer.tiangolo.com/
MIT License
15.77k stars 671 forks source link

Markdown bullet lists in docstrings don't render correctly #449

Open taranlu-houzz opened 2 years ago

taranlu-houzz commented 2 years ago

First Check

Commit to Help

Example Code

import typer

app = typer.Typer(rich_markup_mode="markdown")

@app.command()
def bullet_list(item: str):
    """bullet list

    - 1
    - 2
    - 3
    """

    print(f"Deleting item: {item}")

@app.command()
def nested_bullet_list(item: str):
    """nested bullet list

    - 1
    - 2
      - a
      - b
    - 3
    """

    print(f"Creating item: {item}")

if __name__ == "__main__":
    app()

Description

Bullet lists are rendered incorrectly when rich_markup_mode is set to "markdown". Instead of rendering a list, all list items appear on the same line. This does not happen when the mode is set to "rich".

Operating System

macOS

Operating System Details

No response

Typer Version

0.6.1

Python Version

Python 3.7.12

Additional Context

No response

tancnle commented 1 year ago

Relate to https://github.com/tiangolo/typer/issues/447 of and addressed by https://github.com/tiangolo/typer/pull/671.