Loading...
Loading...
MDX lets you author pages and content in Markdown, dropping into JSX where you
need it. Ossido wires it up through the @ossido-labs/ossido-mdx plugin and a single global
components file - these docs are written in MDX.
Scaffold with --mdx (or the wizard), or add it yourself by putting the
ossidoMdx() plugin from @ossido-labs/ossido-mdx/vite in your Vite plugins:
ossidoMdx() returns an array of plugins, so spread it into plugins. Pass
remark/rehype plugins through mdxOptions - this site adds rehype-slug for
heading anchors:
mdx-components.tsxOssido follows the Next.js convention: export a useMDXComponents function from
src/mdx-components.tsx and every .mdx file picks it up automatically - no
<MDXProvider> needed. Map HTML elements (and your own components) to the design
system:
The plugin resolves src/mdx-components.{tsx,jsx,ts,js}; if the file doesn't
exist, MDX renders with plain elements.
A page.mdx is a route just like a page.tsx - the folder is the URL, so
src/routes/blog/hello/page.mdx serves /blog/hello. You can also import an
.mdx file as a component and render it inside a .tsx page:
Either way, headings, links, fenced code blocks, and the rest render through your
useMDXComponents map - so Markdown content matches the rest of your app without
per-file styling.
Back to Styling · File System Routing