Odd markdown results - unexpected whitespace removal

markdown-it-review
markdown

(Dean Taylor) #1

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

Expected Result

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:


Space before/after inline code gets collapsed sometimes
Help us test the rewritten Composer
#2

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.


(Sam Saffron) #3

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

Can you test there?


#4

Looks like 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.


(Dan Dascalescu) #5

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):

theseshouldbespaces

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


(Sam Saffron) #6

Fixed, OP was rebaked per:

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.


(Sam Saffron) #7