rich icon indicating copy to clipboard operation
rich copied to clipboard

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

Open mroch opened this issue 1 year ago • 1 comments

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

mroch avatar Jun 24 '24 20:06 mroch

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

github-actions[bot] avatar Jun 24 '24 20:06 github-actions[bot]