From c41100a58a5670bb42f01a9f19625f1125f6c8c1 Mon Sep 17 00:00:00 2001 From: Nuno Santos Date: Mon, 2 Dec 2013 23:18:20 +0100 Subject: [PATCH] Added support for Markdown style links. Fixes issue #5. --- index.html | 6 ++++++ life.example.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 73706cc..9ca022c 100644 --- a/index.html +++ b/index.html @@ -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], "" + link[1] + ""); + return '
' + d.time.title + ' ' + d.text + '  
'; return ''; }, diff --git a/life.example.md b/life.example.md index 42c5317..6cfd821 100644 --- a/life.example.md +++ b/life.example.md @@ -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 \ No newline at end of file