marp-share / client /src /marp /render.ts
Nipun's picture
Deploy marp-share (M1–M5): realtime + persistence + HF auth + comments + export
43370b3 verified
Raw
History Blame Contribute Delete
598 Bytes
import { Marp } from '@marp-team/marp-core'
// One reusable Marp instance. inlineSVG is disabled so the rendered output is a
// predictable `<div class="marpit"><section>…</section>…</div>` 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(/<section[\s>]/g) || []).length
return { html, css, count }
}