php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

Easier auto linking

Open xPaw opened this issue 12 years ago • 8 comments

Even simple stuff like http://google.com or https://google.com is not auto linked.

xPaw avatar Apr 28 '13 13:04 xPaw

Ah, according to markdown syntax they should be wrapped in < >, but that's kinda weird. Would be great if there was an option to auto link without angle brackets.

xPaw avatar Apr 28 '13 13:04 xPaw

The <url> syntax has the benefit of working fine with URLs of any protocol. It also allows writing URLs that are not meant to be links. I don't think it's unreasonable to expect authors to write angle-bracketed URLs when they're writing in Markdown. I'm on the opinion that for blog comments, where posters are not necessarily aware of Markdown, that'd make sense.

michelf avatar Apr 28 '13 14:04 michelf

I'm using Markdown for forum comments, so yes it's much easier to autolink without angle brackets.

xPaw avatar Apr 28 '13 14:04 xPaw

The problem is that Markdown wasn't designed with that kind of usage in mind. Autolinks are only one issue for usage in blog comments or in a forum and I'm somewhat hesitant to work or even form an opinion on each issue piecemeal.

michelf avatar Apr 28 '13 14:04 michelf

Well, big websites like GitHub and reddit use markdown, and yet allow easy auto linking. An option wouldn't hurt, would it?

xPaw avatar Apr 28 '13 14:04 xPaw

Maybe, maybe not. I'll look deeper into this when I have the time. But in general each new option adds some room for misuse, interoperability problems, and bugs/conflicts unit tests will have a hard time to detect. That's true especially for options that change how the input is interpreted. I'd be much happier maintaing 2 variations of the parser than 2^n (n being the number of options).

michelf avatar Apr 28 '13 14:04 michelf

@michelf any news on this? I would appreciate it as well. Is there an easy way to implement this? I see how you would not like to add it to the core, but maybe as some kind of plugin / extra?

lukasoppermann avatar Aug 31 '14 09:08 lukasoppermann

I haven't fiddled with this yet. Feel free to implement it as a pull request if you want. It needs to be an option, and be disabled by default. It can probably be added to the base Markdown parser class.

michelf avatar Aug 31 '14 11:08 michelf