code: function doLists(text) {
  
          text += "~0";
  
          var whole_list = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
  
          if(listLevel) {
  
              text = text.replace(whole_list,function(wholeMatch,m1,m2) {
                  var list = m1;
                  var list_type = (m2.search(/[*+-]/g)>-1) ? "ul" : "ol";
  
                  list = list.replace(/\n{2,}/g,"\n\n\n");;
                  var result = processListItems(list);
  
                  result = result.replace(/\s+$/,"");
                  result = "<"+list_type+">" + result + "</"+list_type+">\n";
                  return result;
              });
  
          } else {
  
              whole_list = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;
  
              text = text.replace(whole_list,function(wholeMatch,m1,m2,m3) {
  
                  var runup = m1;
                  var list = m2;
                  var list_type = (m3.search(/[*+-]/g)>-1) ? "ul" : "ol";
                  var list = list.replace(/\n{2,}/g,"\n\n\n");;
                  var result = processListItems(list);
                  result = runup + "<"+list_type+">\n" + result + "</"+list_type+">\n";
  
                  return result;
              });
          }
  
          text = text.replace(/~0/,"");
  
          return text;
      }
docs: }}} {{{ doLists