back to notes

Create HTML obfuscated copies of email addresses on the command-line using markdown

Using the original markdown you can easily convert any email address to an obfuscated version:

# First install markdown if you don't have 
# it already, for example on Ubuntu:
$ sudo apt-get install markdown

$ echo "<hello@example.com>" | markdown
<p><a href="&#109;a&#x69;&#108;&#x74;&#x6F;:&#x68;&#101;&#108;&#108;o&#64;&#x65;&#120;&#x61;&#x6D;&#x70;&#x6C;&#x65;&#x2E;&#x63;&#x6F;&#109;">&#x68;&#101;&#108;&#108;o&#64;&#x65;&#120;&#x61;&#x6D;&#x70;&#x6C;&#x65;&#x2E;&#x63;&#x6F;&#109;</a></p>

This will render as "hello@example.com" in a web browser, but in the HTML source code it's obscured using entity-encoding as above. As noted in the markdown docs:

This sort of entity-encoding trick will indeed fool many, if not most, address-harvesting bots, but it definitely won’t fool all of them. It’s better than nothing, but an address published in this way will probably eventually start receiving spam.



last updated december 2016