const utils = require('../utils/utils.js'); const markdown = require( "markdown" ).markdown; const sql = require('../utils/sql'); var Remarkable = require('remarkable'); var hljs = require('highlight.js'); // Actual default values var md = new Remarkable( { html: true, highlight: function (str, lang) { if (lang && hljs.getLanguage(lang)) { try { return hljs.highlight(lang, str).value; } catch (err) {} } try { return hljs.highlightAuto(str).value; } catch (err) {} return ''; // use external default escaping } }); module.exports= { /** * Renders a preview of the post with a link to view more * * @param res * @param post */ renderPreview: function(post) { return new Promise(function(resolve, reject) { //var html = "
"); for(var i = 0; i < 3; i++) { html+= "
" + htmlPost[i];
}
html = html.split("").join("");
html += "
");
html += "