code: public static String simpleFormat (String text)
      {
          // first replace the image and other URLs
          Matcher m = URL_PAT.matcher(text);
          StringBuffer tbuf = new StringBuffer();
          while (m.find()) {
              String match = m.group();
              String lmatch = match.toLowerCase();
              if (lmatch.endsWith(".png") ||
                  lmatch.endsWith(".jpg") ||
                  lmatch.endsWith(".gif")) {
                  match = "<img src=\"" + match + "\">";
              } else {
                  match = "<a href=\"" + match + "\">" + match + "</a>";
              }
              m.appendReplacement(tbuf, match);
          }
          m.appendTail(tbuf);
  
          // then do our paragraph and list processing
          String[] lines = StringUtil.split(tbuf.toString(), "\n");
          StringBuilder lbuf = new StringBuilder();
  
          boolean inpara = false, inlist = false;
          for (String line2 : lines) {
              String line = line2;
              if (StringUtil.isBlank(line2)) {
                  if (inlist) {
                      lbuf.append("</ul>");
                      inlist = false;
                  }
                  if (inpara) {
                      lbuf.append("</p>\n");
                      inpara = false;
                  }
                  continue;
              }
  
              if (!inpara) {
                  inpara = true;
                  lbuf.append("<p> ");
              }
  
              if (line.startsWith("*")) {
                  if (inlist) {
                      lbuf.append("<li>");
                  } else {
                      lbuf.append("<ul><li>");
                      inlist = true;
                  }
                  line = line.substring(1);
              }
  
              lbuf.append(line).append("\n");
          }
  
          if (inlist) {
              lbuf.append("</ul>");
          }
          if (inpara) {
              lbuf.append("</p>\n");
          }
  
          return lbuf.toString().trim();
      }
docs: Does some simple HTML markup, matching bare image URLs and wrapping
  them in image tags, matching other URLs and wrapping them in href
  tags, and wrapping * prefixed lists into ul-style HTML lists.