Newline inside bold string breaks email parser


(Michael Downey) #1

For some reason, some funky HTML email (thanks, Outlook!) that was sent as follows:

<div><b>@All, d</b><b>o=
es anyone have topics they would like to discuss on today&#39;s call?</b></=

Got rendered as:

If anyone would like the full source to troubleshoot, let me know.

(Jens Maier) #2

Is that the cooked or the raw text of the post?

It reminds me a bit of @cawas’ markdown issue… perhaps the post cooker is failing in a weird way and returns the raw instead of raising an error?

(Michael Downey) #3

The HTML an excerpt from the raw incoming email.

The image is the rendered/cooked result. :smile:

(Jens Maier) #4

Ok, then what’s the raw that resulted in that cooked result? :grin:
(To clarify: the raw text in the post, not the raw email.)

(Michael Downey) #5

I’m not sure how to see that if the post hasn’t been edited. There’s no such option in the admin actions menu. Any ideas?

(Jens Maier) #6

/raw/#{topic_id}/#{post_number}, e.g. :slight_smile:

(Michael Downey) #7

Thanks; more hidden valuable admin features! :confounded:

Raw output of that message shows just like the image excerpt above:

*@All, d**oes anyone have topics they would like to discuss on today's

(Jens Maier) #8

Oh, there’s a newline between today's and call, hence the markdown parser doesn’t apply the inline styling. I wonder how the newline got there since it’s not in the raw email text?

Anyway, looks like a legit bug in the email parser to me.

(Caue Rego) #9

I think this is very different from my case. I believe my case is more related with some kind of overflow and the difference between the preview md renderer and the post md renderer… Also it happened after I’ve edited the email in, so it must not be directly related with the email renderer or HTML conversor… Although this is also not either one’s fault!

IMHO this is all a simple markdown issue, which I’m not sure if it’s by design. If it is intented to be like that, well, then it is indeed a problem with the HTML / email conversor.

So, if there is a new line the markdown renderer does break the formatting. You can try it right here, right now:

*for broken

renders to:

for broken


*for working example*

renders to:

for working example

The only difference there is the break line before example.

(Jens Maier) #10

Yes, it is. Here it’s a superfluous newline, in your case it’s something else, but at first glance both cases looked as if potentially valid markdown simply didn’t get cooked. :wink:

The markdown parser’s behavior is indeed by design. Each line is considered a block and inline-styles cannot span across blocks. This is because the inline parser cannot know whether the two lines will turn into a single paragraph or, for instance, two list items…