const liquid = require('./liquid') const cheerio = require('cheerio') const Entities = require('html-entities').XmlEntities const entities = new Entities() const stripHtmlComments = require('strip-html-comments') const createProcessor = require('./create-processor') // used below to remove extra newlines in TOC lists const endLine = '\r?\n' const blankLine = '\\s*?[\r\n]*' const startNextLine = '[^\\S\r\n]*?[-\\*] ?)\n?`, 'gm') // parse multiple times because some templates contain more templates. :] module.exports = async function renderContent ( template = '', context = {}, options = {} ) { try { // remove any newlines that precede html comments, then remove the comments if (template) { template = stripHtmlComments(template.replace(/\n