# Newline inside bold string breaks email parser

**URL:** https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384
**Category:** Bug
**Tags:** email
**Created:** [April 9, 2015, 1:34pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384 "2015-04-09T13:34:00Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [April 9, 2015, 1:34pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/1 "2015-04-09T13:34:00Z")

</div>

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

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

```

Got rendered as:

![](https://global.discourse-cdn.com/meta/original/3X/6/a/6ab34a6d319de1f9a709c57925cd16bdd5c35c7d.png)

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

---

<div class="post-metadata">

### Author: ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)
#### Post date: [April 9, 2015, 3:27pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/2 "2015-04-09T15:27:50Z")

</div>

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

It reminds me a bit of @cawas’ [markdown issue](https://meta.discourse.org/t/markdown-max-post-length-limit-issues/27323)… perhaps the post cooker is failing in a weird way and returns the raw instead of raising an error?

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [April 9, 2015, 3:32pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/3 "2015-04-09T15:32:41Z")

</div>

The HTML an excerpt from the raw incoming email.

The image is the rendered/cooked result. 😄

---

<div class="post-metadata">

### Author: ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)
#### Post date: [April 9, 2015, 3:33pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/4 "2015-04-09T15:33:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [April 9, 2015, 3:42pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/5 "2015-04-09T15:42:51Z")

</div>

> [@elberet](#):
>
> Ok, then what’s the raw that resulted in that cooked result?

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?

---

<div class="post-metadata">

### Author: ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)
#### Post date: [April 9, 2015, 3:55pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/6 "2015-04-09T15:55:54Z")

</div>

`/raw/#{topic_id}/#{post_number}`, e.g. [https://meta.discourse.org/raw/27384/5](https://meta.discourse.org/raw/27384/5) 🙂

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [April 9, 2015, 5:05pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/7 "2015-04-09T17:05:26Z")

</div>

Thanks; more hidden valuable admin features! 😖

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

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

```

---

<div class="post-metadata">

### Author: ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)
#### Post date: [April 9, 2015, 5:25pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/8 "2015-04-09T17:25:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cregox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cregox/32/115904_2.png) [@cregox](https://meta.discourse.org/u/cregox)
#### Post date: [April 9, 2015, 6:47pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/9 "2015-04-09T18:47:20Z")

</div>

I think this is very different from [my case](https://meta.discourse.org/t/markdown-max-post-length-limit-issues/27323). 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
example*

```

renders to:

> _for broken  
> example_

while

```
*for working example*

```

renders to:

> _for working example_

The only difference there is the break line before `example`.

---

<div class="post-metadata">

### Author: ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)
#### Post date: [April 9, 2015, 9:02pm UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/10 "2015-04-09T21:02:06Z")

</div>

> [@cawas](#):
>
> I think this is very different from my case.

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. 😉

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…

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [August 11, 2020, 3:21am UTC](https://meta.discourse.org/t/newline-inside-bold-string-breaks-email-parser/27384/11 "2020-08-11T03:21:56Z")

</div>


