text: function formatMenuHtml(bookTitle, menuInfo) {
      let allGroupHtml = "<div class=\"book-main-title\"><h1>" + bookTitle + "</h1></div>";
      for (let menuGroupIndex = 0; menuGroupIndex < menuInfo.length; menuGroupIndex++) {
          let groupHtml = "<div class=\"menu-group\">";
          let groupInfo = menuInfo[menuGroupIndex];
          groupHtml += "<div class=\"menu-group-title\">" + groupInfo.title + "</div>";
          groupHtml += "<ul>";
          for (let i = 0; i < groupInfo.list.length; i++) {
              let pageNode = groupInfo.list[i];
              groupHtml += "<li><a href=\"" + pageNode.url + "\">" + pageNode.title + "</a></li>";
          }
          groupHtml += "</ul></div>";
          allGroupHtml += groupHtml;
      }
      return "<!DOCTYPE html>\n" +
          "<html lang=\"en\">\n" +
          "  <head>\n" +
          "    <meta charset=\"utf-8\" />\n" +
          "    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n" +
          "    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\" />" +
          "    <title>" + bookTitle + "</title>\n" +
          "    <link rel=\"stylesheet\" href=\"../css/menu.css\" />\n" +
          "    <link rel=\"stylesheet\" href=\"../../laravel/css/menu-extra.css\"/>\n" +
          "  </head>\n" +
          "  <body>\n" + allGroupHtml + "\n" +
          "<div class=\"menu-tip\"><span>Generated by</span><a href=\"https://github.com/liuguangw/pdf-builder\">pdf-builder</a></div>\n" +
          " </body>\n" +
          "</html>";
  }
  
  module.exports = (bookInfo, menuInfo, menuHtmlCallback, errorFn) => {
      let htmlCode = formatMenuHtml(bookInfo.title, menuInfo);
      menuHtmlCallback(htmlCode);
  };