Fixed Markdown link detection to support multiple instances.

Fixes issue #5.
This commit is contained in:
Nuno Santos 2013-12-02 23:53:48 +01:00
parent c41100a58a
commit 3e98a54109

View File

@ -233,10 +233,11 @@ h1{
// Parse Markdown links in the text
// credit: http://stackoverflow.com/a/9268827
var link = d.text.match(/\[([^\]]+)\]\(([^)]+)\)/);
if (link)
var link = null;
while(link = d.text.match(/\[([^\]]+)\]\(([^)]+)\)/)) {
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 '';
},