Add support for markdown-style headlines (lines beginning with #)
authorChip Black <bytex64@bytex64.net>
Wed, 2 Mar 2011 23:11:01 +0000 (15:11 -0800)
committerChip Black <bytex64@bytex64.net>
Wed, 2 Mar 2011 23:11:01 +0000 (15:11 -0800)
www/js/blerg.js

index 3c4cc0e..d227a7a 100644 (file)
@@ -363,12 +363,12 @@ function mangleRecord(record, template) {
             endpush = '</li>';
         }
 
-        // Create headers when lines begin with =
-        if (l[0] == '=') {
-            var m = l.match(/^(=+)/);
+        // Create headers when lines begin with = or #
+        if (l[0] == '=' || l[0] == '#') {
+            var m = l.match(/^([=#]+)/);
             var depth = m[1].length;
             if (depth <= 5) {
-                l = l.replace(/^=+\s*/, '').replace(/\s*=+$/, '');
+                l = l.replace(/^[=#]+\s*/, '').replace(/\s*[=#]+$/, '');
                 out.push('<h' + depth + '>');
                 endpush = '</h' + depth + '>';
             }