# Odd markdown results - unexpected whitespace removal

**URL:** https://meta.discourse.org/t/odd-markdown-results-unexpected-whitespace-removal/28989
**Category:** Bug
**Tags:** markdown-it-review, markdown
**Created:** [2015 年 5 月 19 日午後 1:08 UTC](https://meta.discourse.org/t/odd-markdown-results-unexpected-whitespace-removal/28989 "2015-05-19T13:08:53Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [2015 年 5 月 19 日午後 1:08 UTC](https://meta.discourse.org/t/odd-markdown-results-unexpected-whitespace-removal/28989/1 "2015-05-19T13:08:53Z")

</div>

The following markdown seems to remove white space between letters on the 2nd line

### Markdown Code

```
`leosomethingelse` - `leo address 1` - created `1 year ` - mem `period 11` & `period 12` - seen `6 hours ago`
`leo` x `leo address 2` - created `>10 years` - mem `period 05 to period 08` - seen `never on this planet`

```

### Actual Result

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

### Expected Result

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

### As it displays on here right now

`leosomethingelse` - `leo address 1` - created `1 year ` - mem `period 11` & `period 12` - seen `6 hours ago`  
`leo` x `leo address 2` - created `>10 years` - mem `period 05 to period 08` - seen `never on this planet`

### Notes

Introducing a new line between the two lines displays this result, noting the white space between characters on the 2nd line is correct:  
 ![](https://global.discourse-cdn.com/meta/original/3X/9/b/9b526874831e3c6393840b07e7d8a64d9ce1b600.png)

---

<div class="post-metadata">

### Author: ![MT\_](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@MT\_](https://meta.discourse.org/u/MT_)
#### Post date: [2015 年 10 月 27 日午後 3:01 UTC](https://meta.discourse.org/t/odd-markdown-results-unexpected-whitespace-removal/28989/2 "2015-10-27T15:01:49Z")

</div>

Below are some specific information on how to reproduce the bug and simplified testcases (planned to post this as a bug report, but noticed there is an existing similar thread, so commenting instead):

**Bug: whitespace disappears after two adjacent inline code fragments**

There is no visible whitespace (though there is in source markdown) after two adjacent code fragments if:

- the fragments are separated with whitespace or with a single nonwhitespace character _not_ surrounded with whitespace;
- _and_ there is another inline code fragment _after_ noncode text placed after the first two code fragments.

**Testcases:**

`foo` `bar` (not code) `code`.

`foo`/`bar` (not code) `code`.

* * *

For nonwhitespace separator, a workaround is to add a space before and/or after the separator:

`foo` / `bar` (not code) `code`.

I am not aware of a workaround for fragments separated with just whitespace.

* * *

This looks like a specific bug of the Discourse flavor of Markdown since, for example, GitHub’s markdown parser is **not** affected.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年 10 月 27 日午後 11:33 UTC](https://meta.discourse.org/t/odd-markdown-results-unexpected-whitespace-removal/28989/3 "2015-10-27T23:33:43Z")

</div>

We will revisit this when we move to our new markdown engine [https://markdown-it.github.io](https://markdown-it.github.io)

Can you test there?

---

<div class="post-metadata">

### Author: ![MT\_](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@MT\_](https://meta.discourse.org/u/MT_)
#### Post date: [2015 年 10 月 28 日午後 9:40 UTC](https://meta.discourse.org/t/odd-markdown-results-unexpected-whitespace-removal/28989/4 "2015-10-28T21:40:18Z")

</div>

Looks like [markdown-it.github.io](http://markdown-it.github.io) Markdown implementation is _not_ affected by the bug at least with my testcases.

What is an approx. schedule for replacing the existing Discourse’s MD engine with the new one? Thanks.

---

<div class="post-metadata">

### Author: ![dandv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dandv/32/169779_2.png) [@dandv](https://meta.discourse.org/u/dandv)
#### Post date: [2016 年 2 月 20 日午前 8:20 UTC](https://meta.discourse.org/t/odd-markdown-results-unexpected-whitespace-removal/28989/5 "2016-02-20T08:20:06Z")

</div>

I don’t think we have moved to Markdown-it yet, because single spaces between backticks are eaten up in (here’s the [raw post code](https://meta.discourse.org/raw/28989/5)):

> these` `should` `be` `spaces

and this doesn’t happen at [https://markdown-it.github.io/](https://markdown-it.github.io/)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017 年 6 月 26 日午後 7:50 UTC](https://meta.discourse.org/t/odd-markdown-results-unexpected-whitespace-removal/28989/6 "2017-06-26T19:50:08Z")

</div>

Fixed, OP was rebaked per:

> [@CommonMark testing started here!](https://meta.discourse.org/t/commonmark-testing-started-here/65121):
>
> Per our [migration plans](https://meta.discourse.org/t/discourse-commonmark-migration-plans-confetti-ball-balloon), I just enabled [markdown.it](https://github.com/markdown-it/markdown-it) at Meta. It is an excellent [CommonMark](http://commonmark.org/) compliant engine. I expect quite a few edges to be found during this period of testing. Do not open bugs about the new Engine, just reply here. I/we will be updating the top post here with the list of issues and striking out stuff as it is fixed. Current known issues (to be fixed)white_check_mark Onebox vanishes after you start typing and works not-super consistently white_check_mark pending…

### Notes

For, `###Notes` to be a heading you now need to add a space between `#` and `N`, this is by design and a big confusion reducer.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017 年 6 月 26 日午後 7:50 UTC](https://meta.discourse.org/t/odd-markdown-results-unexpected-whitespace-removal/28989/7 "2017-06-26T19:50:15Z")

</div>


