Local Markdown
Read Markdown files on the server.
Local Markdown reads files on the server instead of compiling them in a bundler. Its pages render with your MDX components.
import statements are not available.Setup
Install the Package
npm i @fumadocs/local-md shikiCreate the Source
import { createPress } from "@fumapress/astro/config";
import { localMd } from "@fumadocs/local-md";
const docs = localMd({ dir: "content/docs" });
export default createPress(docs.dynamicSource());dynamicSource() reads files on the server, so the site needs a server. To prerender the pages instead, pass await docs.staticSource().
Content Updates
Fumapress reads your files once. To see changes, use hot reload on the dev server, and refresh the content on a deployed site.
Hot Reload
The dev server doesn't watch these files by default. Add the Vite plugin, then connect your source:
import { localContentPlugin } from "@fumadocs/local-md/dev/vite";
export default defineConfig({
integrations: [press()],
vite: {
plugins: [
tailwindcss(),
localContentPlugin(),
],
},
});Refreshing Content
The source is read once, so new content doesn't appear on its own. Choose when to read it again:
createPress(source, {
alwaysRevalidate: true,
});Reading on every request works for low traffic. On a busier site, call the webhook when your content changes.
See Local Markdown in the Fumadocs docs for schemas and other options. Local HTML and Python sources work the same way.
Last updated on