evilstreak / markdown-js

A Markdown parser for javascript
7.7k stars 863 forks source link

Enable spaces in a link/image url #48

Closed sbstjn closed 11 years ago

sbstjn commented 12 years ago

Changed the regular expression for handling links and images, whitespaces are now allowed in a link url or image url. GitHub allows this, so it seems legit to change…

[link text](Link to file/Lorem Ipsum.txt "Alt2") is [link text](Link to file/Lorem Ipsum.txt)

ashb commented 12 years ago

Hmmm interesting one.

The original markdown parser didn't accept this, nor do about half the other parsers covered by this babelmark:

http://babelmark.bobtfish.net/?markdown=%5Blink+text%5D%28Link+to+file%2FLorem+Ipsum.txt+%22Alt2%22%29

Spaces in URLs are an abomination but that's a whole other issue :)

sbstjn commented 12 years ago

Afaik GitHub uses for redcarpet for its Markdown conversion.

In my case I'm linking to local files on a desktop computer's file system. So it's kinda ok to use spaces in links, but of course those links and files with spaces get never deployed into the wild ;)

evilstreak commented 11 years ago

I agree with @ashb that spaces in URLs and paths are pretty nasty, but I don't think allowing it does any harm.

@semu I couldn't use your changes as they broke several other link and image tests, but I have added tests and a fix for this request in 8bf90223901cd7a0fd43403bfa9f23de4f649ee9.