Skip to main content
2 of 5
added 709 characters in body

The link definition names are stored in an Array. Arrays have reduce as a method, which seems to be the source of the problem. You can reproduce it with concat or filter or any other Array method, too. I'm no Javascript expert, and I haven't dug far enough into the problem to figure out just why it happens -- especially because it begins working again if you include the optional title for the link -- but you can see for yourself that it affects the base WMD implementation, too, not just SO's version.

EDIT:

So the problem is that indexing any object in Javascript with a method name returns the function itself. The structure of the Markdown editor is such that it stores URLs and link titles in two arrays, both of which are indexed by the link definition name. The markdown converter craps out when attempting to escape characters on the function code returned when the index is a function name. You have to have the optional title, because if you omit it, it still thinks it has a title and attempts to escape characters on the function. It begins working when you have the URL and option text in place, because the function gets overwritten in the two arrays with the proper strings.