import liquid from './liquid.js' import cheerio from 'cheerio' import { encode } from 'html-entities' import stripHtmlComments from 'strip-html-comments' import createProcessor from './create-processor.js' // 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. :] async function renderContent(template = '', context = {}, options = {}) { // If called with a falsy template, it can't ever become something // when rendered. We can exit early to save some pointless work. if (!template) return template try { // remove any newlines that precede html comments, then remove the comments if (template) { template = stripHtmlComments(template.replace(/\n