Spaces:
Sleeping
Sleeping
| 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 } | |
| } | |