Merge pull request #12 from nfvs/support-for-markdown-links
Added support for Markdown style links. Fixes issue #5.
This commit is contained in:
commit
424e3934a3
11
index.html
11
index.html
@ -247,6 +247,17 @@ h1{
|
||||
}
|
||||
}
|
||||
|
||||
// Parse Markdown links in the text
|
||||
// credit: http://stackoverflow.com/a/9268827
|
||||
var link = null;
|
||||
while(link = d.text.match(/\[([^\]]+)\]\(([^)"]+)(?: \"([^\"]+)\")?\)/)) {
|
||||
var link_attr = "";
|
||||
if (link[3] !== undefined) {
|
||||
link_attr = " title='" + link[3] + "'";
|
||||
}
|
||||
d.text = d.text.replace(link[0], "<a href='" + link[2] + "'" + link_attr + ">" + 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 + ' '
|
||||
|
@ -4,5 +4,5 @@
|
||||
- 24/02/1955 Born
|
||||
- ~1968 Summer job
|
||||
- 03/1976 Built a computer
|
||||
- 01/04/1976 Started a company
|
||||
- 01/04/1976 Started a [company](http://en.wikipedia.org/wiki/Apple_Inc. "Apple Inc.")
|
||||
- 04/1976-2011 Whole bunch of interesting events
|
Loading…
Reference in New Issue
Block a user