const utils = require('../utils/utils.js'); var Promise = require('promise'); var markdown = require( "markdown" ).markdown; const sql = require('../utils/sql'); var Remarkable = require('remarkable'); var hljs = require('highlight.js') // https://highlightjs.org/ // 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= { /** * renderPost() displays a single blog post in it's entirety * * @param res result sent to user * @param post sql data about the blog post * @return {*|Promise} */ renderPost: function(res, post) { return new Promise(function (resolve, reject) { var html = "