const { Marp } = require('@marp-team/marp-core'); const hljs = require('highlight.js'); module.exports = { engine: (opts) => { const marp = new Marp(opts); const md = marp.markdown; const defaultInline = md.renderer.rules.code_inline || ((tokens, idx, options, env, self) => `${md.utils.escapeHtml(tokens[idx].content)}`); md.renderer.rules.code_inline = (tokens, idx, options, env, self) => { const content = tokens[idx].content; try { const highlighted = hljs.highlight(content, { language: 'html', ignoreIllegals: true }).value; return `${highlighted}`; } catch (e) { return defaultInline(tokens, idx, options, env, self); } }; return marp; } };