commit:0a73588293307fc51c995bda6f98e082a61df89c
author:Chip Black
committer:Chip Black
date:Mon Jan 10 02:17:46 2011 -0800
parents:f13f6cbe98cab2e170fb714047cd794fbd39e228
Add italic/bold markdown syntax
diff --git a/www/js/blerg.js b/www/js/blerg.js
line changes: +4/-0
index 737d84c..2ee3467
--- a/www/js/blerg.js
+++ b/www/js/blerg.js
@@ -252,6 +252,10 @@ function mangleRecord(record, template) {
     // Turn markdown links into links
     record.data = record.data.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)]*?)?)\)/, '$1<a href="$3">$2</a>');
 
+    // Turn *foo* into italics and **foo** into bold
+    record.data = record.data.replace(/(\s)\*\*([^*]+)\*\*(\s)/, '$1<b>$2</b>$3');
+    record.data = record.data.replace(/(\s)\*([^*]+)\*(\s)/, '$1<i>$2</i>$3');
+
     // Turn refs and tags into links
     record.data = record.data.replace(/(\s|^)#(\w+)/g, '$1<a href="#tag/$2">#$2</a>');
     record.data = record.data.replace(/(\s|^)@(\w+)/g, '$1<a href="#$2">@$2</a>');