Dear readers, of the Markdown-(Extra)-Discussion list. After including Markdown as the Markup language of choice for my configuration files I stumbled over a feature I was missing: Adding e-mail links with names. I came up with a little hack I want to share with you. Old Syntax: (mailto:$mailadress@$mailhost) New Syntax: (mailto:$mailadress@$mailhost[ My Name) changes: 1) function doAutoLinks: insert '(?:\W*(.*))' in RegEx before the '>' line 2) function _doAutoLinks_email_callback: insert '$text = $matches[3];' before line starting with $link = ... 3) function encodeEmailAdress: a) change signature to ($addr, $text) b) wrap the line starting with $text = ... so it reads 'if ($text == "") { $text = ... }' pretty easy, istn't it? Greetings, Berengar
On Feb 1, 2011, at 4:34 AM, Berengar wrote:> Dear readers, > > of the Markdown-(Extra)-Discussion list. After including Markdown as > the Markup language of choice for my > configuration files I stumbled over a feature I was missing: Adding > e-mail links with names. I came up with a > little hack I want to share with you. > > Old Syntax: (mailto:$mailadress@$mailhost) > New Syntax: (mailto:$mailadress@$mailhost[ My Name)How is this better than the traditional [name](mailto:address) syntax? -david parsons
On Tue, Feb 1, 2011 at 07:34, Berengar <Berengar.Lehr at gmx.de> wrote:> > changes: > 1) function doAutoLinks: insert '(?:\W*(.*))' in RegEx before the '>' line > 2) function _doAutoLinks_email_callback: insert '$text = $matches[3];' before line starting with $link = ... > 3) function encodeEmailAdress: > ?a) change signature to ($addr, $text) > ?b) wrap the line starting with $text = ... so it reads 'if ($text ?== "") { $text = ... }'You also need to pass $text to encodeEmailAddress in the callback.> New Syntax: (mailto:$mailadress@$mailhost[ My Name)I don't know if I mistyped something in applying your edits, or there's something wrong in the "New Syntax", but it didn't work when I tried this.> pretty easy, istn't it?A patch would have been easier and more fool proof. What would be a beneficial addition, would be adding email obfuscation capabilities to the [text](email) syntax. Currently the only way to achieve obfuscation is with the <email> syntax. -- arno? s? hautala? ? /-|?? arno at alum.wpi.edu pgp b2c9d448