3

I was typing an answer and some text just randomly disappeared in the preview. I've crafted a (hopefully MCVE) example where text in between doesn't render. As @amimuson mentions, the bug seems to be caused by the apostrophe being interpreted as a title attribute.

I'm using Firefox on desktop.

Edit: @amimuson has given a good explanation, but it doesn't explain why the rendering differs between the preview and the submission. It also doesn't seem to square completely with the link's destination: shouldn't it go to https://en.wikipedia.org/wiki/Don instead of https://en.wikipedia.org/wiki/Don't_repeat_yourself if the ' began a title attribute? Clearly, there's some inconsistency here, or I lack a clear understanding of how the Markdown is supposed to work.

Edit 2: Adding a second example is explanatory. It seems that in parsing a link, the markdown prioritizes a closing parenthesis over a second apostrophe if a closing parenthesis occurs first, but mismatches the rendering with the url-linking behavior in the preview. The second example shows that the title attribute is now set to the exclusion of being part of the link. But the second example also shows that link still misrenders in the preview even when the title attribute is supposedly closed, and the corresponding disappearing text still disappears.

Example 1 (the original)

Input

[a link](https://en.wikipedia.org/wiki/Don't_repeat_yourself). This sentence disappears in preview. `')` Text afterwards renders.

Output:

a link. This sentence disappears. ') Text afterwards renders.

Example 2

Input:

[a link](https://en.wikipedia.org/wiki/The_Rock_'n'_Roll_Express). This sentence disappears. `')` Text afterwards renders.

Output:

a link. This sentence disappears. ') Text afterwards renders.

  • 1
    I can only reproduce in the editor preview, it doesn't happen once rendered in the actual post. But it's because link syntax allows for [link name](hyperlink 'title') format, and it's seeing the ' in your URL and then going to the next ') to close the link at that point. The text isn't disappearing, but rather being inserted into the title attribute of the link. – animuson Dec 21 '18 at 20:44
  • Not reproduced on my Windows 7 Enterprise x64 system running under Chrome 71.0.3578.98. Nor on IE11, same system. Note that this is in the actual post, not in the editor as @animuson seems to have found. – Jeff Zeitlin Dec 21 '18 at 20:45
  • @amimuson Ah, that makes sense. Clearly, the lesson is to url-encode '. It is a bit strange that the preview differs from the final version though. – Graham Dec 21 '18 at 20:48

You must log in to answer this question.

Browse other questions tagged .