Sergio
Sergio

Reputation: 8672

Obfuscating email in Markdown

I want to include my email in the readme.md file in a github repository. Of course, I want to somehow obfuscate it in order to avoid spam.

From this tutorial I read the text below:

Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity-encoding to help obscure your address from address-harvesting spambots. For example, Markdown will turn this:

<[email protected]> into something like this:

<a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65; &#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111; &#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61; &#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>

I did what they said, but when I inspect the source code of the github page containing the readme file, I still can see this:

<a href="[email protected]">[email protected]</a>

Am I missing something ? It seems to me that a bot should be able to find that if it is in the source code of the web page.

Upvotes: 3

Views: 7228

Answers (3)

Shane
Shane

Reputation: 71

I would recommend creating and embedding images of text into your HTML and Markdown documents. While soon may not be the case, most simple crawlers are not set up to detect text in images.

There are simple methods to batch generate text on a Unix command line using Image Magick (commonly installed on most servers by default). The output is fully customizable (including size, font, colors, borders, backgrounds, etc.)

Here is a simple example, adapted from a post on commandlinefu.com:

echo -e "email.address@host" | convert -background none -density 196 -resample 72 -unsharp 0x.5 -font "Courier" text:- -trim +repage -bordercolor white -border 0 email-address-image.gif

This example produces a file (email-address-image.gif) which can be embedded inline a Markdown document like so:

![email address image](http://cmscoby.com/public/pics/email-address-image.gif)

link to example email address image

This method requires another step of generating the image (Admittedly, which may be beyond your requirements, if you need a code snippet that can only go in your Markdown or HTML document.)

Upvotes: 7

Adam B
Adam B

Reputation: 1158

GitHub DOES have this feature! It's pretty pointless as the email address in the href of the links stays intact and as mentioned here it wont stop any decent crawler anyway but nonetheless, to take advantage of this feature just write your emails like so <[email protected]> and they will automatically be turned into mailto links with obfuscated text.

Upvotes: -1

SLaks
SLaks

Reputation: 887245

GitHub's Markdown engine does not have this feature.

It's not worth using anyway; it won't stop any modern crawlers.

Upvotes: 5

Related Questions