Math and Mermaid extensions
Math and Mermaid are optional packages. They are not dependencies of @markvia/core.
pnpm add @markvia/math @markvia/mermaidUse only the plugin that your application needs:
import { createMarkdown } from '@markvia/core'import { createMathPlugin } from '@markvia/math'import { createMermaidPlugin } from '@markvia/mermaid'
const runtime = createMarkdown({ plugins: [ createMathPlugin({ provider: mathProvider }), createMermaidPlugin({ provider: mermaidProvider }), ],})Math syntax
Section titled “Math syntax”Inline math: $x^2$
$$\int_0^1 x^2 dx$$
```math\frac{a}{b}```Without @markvia/math, these remain ordinary Markdown text or code blocks.
Mermaid syntax
Section titled “Mermaid syntax”```mermaidgraph TD A --> B```Without @markvia/mermaid, Mermaid remains a regular code block.
Providers
Section titled “Providers”Providers can be synchronous or asynchronous and must return structured render fragments. They must not return raw HTML. When a provider is missing or fails, Markvia displays the source in a safe code fallback.
If math is not used, do not install @markvia/math; its parser dependencies are then not
installed. Neither optional package installs a rendering engine. Install the rendering engine and
connect it through a provider only when rendered output is needed.