Textualize / rich

Rich is a Python library for rich text and beautiful formatting in the terminal.
https://rich.readthedocs.io/en/latest/
MIT License
48.1k stars 1.69k forks source link

[REQUEST] add `breaks` option to `Markdown` #3395

Open mroch opened 1 week ago

mroch commented 1 week ago

in Markdown, a newline in a paragraph is a "soft break", unless it is preceded by two spaces or a backslash to make it a "hard break". soft breaks are rendered as spaces; hard breaks are rendered as line breaks.

MarkdownIt has a breaks=True option that renders softbreaks as a line break. I'd like that option on rich.markdown.Markdown too.

i'm thinking this is an easy "\n" if self.breaks else " " here:

https://github.com/Textualize/rich/blob/349042fd8912ab5f0714ff9a46a70ef8a4be4700/rich/markdown.py#L613-L616

github-actions[bot] commented 1 week ago

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory