@booga/vmdx
v0.1.1
Published
MDX compiler. Build-time and dev-runtime. Frontmatter typed, Vite plugin included, default components wired to vUi primitives.
Readme
vMdx
MDX compiler — build-time and dev-runtime. Frontmatter typed. Vite plugin included. Default components wired to vUi primitives.
Install
npm install @booga/vmdx react react-domVite plugin requires vite (peer, optional):
npm install -D viteCore API
import { compile, compileFile } from "@booga/vmdx";
const { code, frontmatter } = await compile("# Hello");
const { code, frontmatter } = await compileFile("./docs/intro.mdx");compile() defaults to function-body output (eval-safe). Override with outputFormat: "program" for static import() use.
Frontmatter
YAML and TOML supported. Missing frontmatter → {}.
---
title: My Post
published: true
---
# Bodyconst { frontmatter } = await compile(source);
// frontmatter: { title: "My Post", published: true }TOML via ---toml delimiter:
---toml
title = "TOML Post"
---Vite plugin
import { vitePlugin } from "@booga/vmdx/vite/plugin";
export default defineConfig({
plugins: [vitePlugin()],
});Transforms .mdx → React component module. Caches by content hash + mtime.
Config
import { MdxConfigSchema } from "@booga/vmdx";
const config = MdxConfigSchema.parse({
remarkPlugins: [remarkGfm],
rehypePlugins: [],
components: {},
cacheDir: ".vmdx-cache",
});No GFM by default. Opt in via remarkPlugins.
Default components
import { defaultComponents } from "@booga/vmdx";Maps h1..h6, p, ul, ol, li, code, pre, blockquote, a to @booga/vui Box primitives.
Types
import type { Frontmatter, MdxConfig, CompileResult } from "@booga/vmdx";
type PostFrontmatter = Frontmatter<{ title: string; published: boolean }>;Code of conduct
License
MIT © 2026 bvasilenko
