const pandoc = require('node-pandoc'); const utils = require('../utils/utils.js'); const sql = require('../utils/sql'); const argsFull = '-S --base-header-level=1 --toc --toc-depth=3 -N --normalize -s --mathjax -t html5'; const argsPreview = '-S --normalize -s --mathjax -t html5'; module.exports= { generateBlogPost: function(post, blocks) { return new Promise(function(resolve, reject) { Promise.all([module.exports.generateBlogPostHeader(post), module.exports.generateBlogPostBody(post, blocks), module.exports.generateBlogPostFooter()]).then(function(content) { resolve(content.join('')); }) }); }, generateBlogPostHeader: function(post) { var htmlHead = "
"); var html = ""; for(var i = 0; i < blocks; i++) { html += "
" + htmlBlocks[i]; } html += "
");
resolve(html);
};
if(type == -1)
{
pandoc(markdownContents, argsFull, callback);
}
else
{
pandoc(markdownContents, argsPreview, callback);
}
});
},
}