That should guarantee proper preference between bold/italic and lists
[blerg.git] / www / js / blerg.js
index 7203f09..38e3f72 100644 (file)
@@ -326,8 +326,8 @@ function mangleRecord(record, template) {
         l = l.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)"]*?)?)\)/g, '$1<a href="$3">$2</a>');
 
         // Turn *foo* into italics and **foo** into bold
-        l = l.replace(/(\W|^)\*\*([^*]+)\*\*(\W|$)/g, '$1<b>$2</b>$3');
-        l = l.replace(/(\W|^)\*([^*]+)\*(\W|$)/g, '$1<i>$2</i>$3');
+        l = l.replace(/(\W|^)\*\*(\w[^*]*)\*\*(\W|$)/g, '$1<b>$2</b>$3');
+        l = l.replace(/(\W|^)\*(\w[^*]*)\*(\W|$)/g, '$1<i>$2</i>$3');
 
         // Turn refs and tags into links
         l = l.replace(/(\s|^)#([A-Za-z0-9_-]+)/g, '$1<a href="#/tag/$2" class="ref" onclick="return qlink()">#$2</a>');