matterhorn-chat / matterhorn

A feature-rich Unix terminal client for the Mattermost chat system
BSD 3-Clause "New" or "Revised" License
1.05k stars 77 forks source link

markdown quoting improperly applied on multi-line messages #752

Closed setharnold closed 2 years ago

setharnold commented 2 years ago

Hello, I sent a multi-line message, where the first line was quoting from an email. The message I sent was along the lines of:

> short sentence clipped from email
wow this is crazy

What displayed was along the lines of:

> short sentence clipped from email
> wow this is crazy

This attributed to someone else my own words.

Funny enough, the other way around works fine:

wow this is crazy
> short sentence clipped from email

displayed exactly as sent.

I'm using the matterhorn snap version 50200.13.0-67-g5161e1f3.

Thanks

jtdaugherty commented 2 years ago

Thanks for the report! The behavior you are observing is actually the expected and correct behavior according to the CommonMark specification, and Matterhorn uses a CommonMark parser to parse the markdown text that you enter. (Unfortunately, the official Mattermost clients do not, but I believe they ultimately want to transition to CommonMark at some point.) You can see for yourself by testing similar input:

https://spec.commonmark.org/dingus/?text=%3E%20%23%20Foo%0A%0AStuff%3A%0A%0A%3E%20bar%0Abaz%0Ablah%0A%0AThings

To get the behavior you want, you'll just need to put an empty line in between the last line of the block quote and the first line of your non-block-quoted text.

jtdaugherty commented 2 years ago

Also, for what it's worth, the behavior you're seeing is also the behavior of the official web client. So CommonMark or no, I think you'll still need that additional empty line.

setharnold commented 2 years ago

Oh cool! Thanks for the very quick education :)