Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email links support #3

Closed
hkdobrev opened this issue Jul 20, 2013 · 7 comments
Closed

Email links support #3

hkdobrev opened this issue Jul 20, 2013 · 7 comments

Comments

@hkdobrev
Copy link
Contributor

Parsedown does not support email links.

http://daringfireball.net/projects/markdown/syntax#autolink

According to the spec it also has to support obfuscation of the email address.

@erusev
Copy link
Owner

erusev commented Jul 20, 2013

Email link support is coming in version 0.2.0.

@hkdobrev
Copy link
Contributor Author

Great! You could create a milestone :)

BTW, here is a failing test for email: https://github.com/hkdobrev/parsedown/commit/2c21118d806d0e07651e788201211b3185876acc

@hkdobrev
Copy link
Contributor Author

What's up with this one?

@scottchiefbaker
Copy link

Any progress on this? Seems simple, and it is part of the original markdown syntax.

@erusev erusev closed this as completed in 68f2871 Jan 22, 2014
@hkdobrev
Copy link
Contributor Author

@erusev Great! Perhaps you should mention Parsedown does not support obfuscation in the readme or something. It could be useful for systems which rely on this feature and consider changing their Markdown parser.

@jenstornell
Copy link

@hkdobrev

For someone who wants obfuscated emails, quick and dirty:

Add this somewhere outside the class.

function getObfuscatedEmailLink($email) {
    $out = '';
    for($i=0; $i < strlen($email); $i++){
        $out .= "&#" . ord($email[$i]) . ";";
    }
    return $out;
}

In the element function put this:

if($name == 'href') {
  $markup .= " $name=\"".$value.'"';
} else {
  $markup .= " $name=\"".self::escape($value).'"';
}

In the inlineEmailTag put this:

$url = getObfuscatedEmailLink($url);
$url = "mailto:$url";

@janstieler
Copy link

@jenstornell
can you more explain on which lines I have to put the code in?
And is there also a way to do it for md files? I mean if i don't use markdown inline.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants