Added support for Markdown style links. Fixes issue #5.

This commit is contained in:
Nuno Santos 2013-12-02 23:18:20 +01:00
parent baa72a4f62
commit c41100a58a
2 changed files with 7 additions and 1 deletions

View File

@ -231,6 +231,12 @@ h1{
}
}
// Parse Markdown links in the text
// credit: http://stackoverflow.com/a/9268827
var link = d.text.match(/\[([^\]]+)\]\(([^)]+)\)/);
if (link)
d.text = d.text.replace(link[0], "<a href='" + link[2] + "'>" + link[1] + "</a>");
return '<div class="event" style="margin-left: ' + offset.toFixed(2) + 'px"><div class="time" style="width: ' + width.toFixed(2) + 'px"></div><b>' + d.time.title + '</b> ' + d.text + '&nbsp;&nbsp;</div>';
return '';
},

View File

@ -2,7 +2,7 @@
===============
- 24/02/1955 Born
- ~1968 Summer job
- ~1968 Summer [job](http://en.wikipedia.org/wiki/Beach)!
- 03/1976 Built a computer
- 01/04/1976 Started a company
- 04/1976-2011 Whole bunch of interesting events