2

When one writes the following Markdown:

[Googling](http://google.com/search?q="foo bar")

something weird happens (at least on the English SE and Meta SE).

The Markdown is rendered as a link in the preview (underneath the edit-textarea), but when one views the question on the page, it is rendered like the Markdown source code.

I can understand the Markdown interpreter has problems with the spaces in the URL, these are mainly a result of a copy-paste of the Firefox url-bar. And when one uses the escaped version, no problems occur. The preview is probably rendered by JavaScript whereas the questions/answers are probably rendered at server side by a different software package.

It is however rather strange, the two versions interpret the Markdown slightly different.

Of course this is a minor "bug", but as always: it is nice if the preview and the page render the same result, this saves users editing the page multiple times. Even if it only saves a second, with 1M+ users, it will save a few years of working time eventually.

Demo:

(hit [edit] to compare both versions)

[Googling](http://google.com/search?q="foo bar")

Rendered correctly

  • FWIW, JavaScript actually doesn't render it correctly. It completed loses the "foo bar" on the end of the URL and only includes up to the ?q= in the rendered link. So it chokes on it too, just in a different way. – animuson Jan 2 '15 at 14:39
  • @animuson: you are right. Although it is probably better if both renders agree on the result... – Willem Van Onsem Jan 2 '15 at 14:42
  • Quotation marks are not valid characters in a URL ... neither are spaces FWIW. the link you give isn't recognized as one since... well it isn't a valid link. – Vogel612's Shadow Jan 2 '15 at 15:03
  • 1
    @Vogel612'sShadow: this is indeed true (as already specified in the question). But anyway, both renderers better generate the same result. And this can be an indication for a more severe problem in the parser. I guess the JavaScript parser simply aims to parse anything between the square brackets and later tries to find out whether it is a valid url, where as the server-side parser parses token-by-token and when it fails to recognize the url, falls-back on the alternative of presenting the raw Markdown. – Willem Van Onsem Jan 2 '15 at 15:07

You must log in to answer this question.

Browse other questions tagged .