@davaux/mdx
v0.9.0
Published
MDX route plugin for Davaux — adds .page.mdx support with JSX in markdown
Downloads
25
Readme
@davaux/mdx
MDX route plugin for Davaux — adds .page.mdx support with JSX in Markdown.
Installation
npm install @davaux/mdxSetup
// davaux.config.ts
import { defineConfig } from 'davaux/config'
import { mdx } from '@davaux/mdx'
export default defineConfig({
plugins: [mdx()],
})Route files
Any file matching *.page.mdx in src/routes/ is treated as a page. YAML frontmatter sets the <title>, meta description, and any other head meta. JSX components can be imported and used inline:
---
title: Getting Started
description: Learn the basics
---
import { Counter } from '../islands/Counter.tsx'
# Getting Started
Here is a live counter:
<Counter initial={0} />Frontmatter keys title and description map to ctx.head.title / ctx.head.description. All other keys become ctx.head.meta entries.
<a> tags and imported <Link> components automatically respect the app's basePath.
Options
| Option | Type | Default | Description |
|---|---|---|---|
| remarkPlugins | unknown[] | [] | Extra remark plugins |
| rehypePlugins | unknown[] | [] | Extra rehype plugins |
GFM (GitHub-Flavored Markdown) is enabled by default.
