import { Marp } from '@marp-team/marp-core'
// One reusable Marp instance. inlineSVG is disabled so the rendered output is a
// predictable `
…
` structure that we
// can slice into a single-slide stage and a thumbnail rail.
const marp = new Marp({ inlineSVG: false })
export interface RenderResult {
html: string
css: string
count: number
}
export function renderMarp(markdown: string): RenderResult {
const { html, css } = marp.render(markdown)
const count = (html.match(/]/g) || []).length
return { html, css, count }
}