Skip to Content

Obsidian

Publish an Obsidian vault as a docs site.

Fumapress renders your vault with its wikilinks, embeds, callouts, block IDs and comments.

Setup

Install the Package

npm i fumadocs-obsidian

Add the Styles

Add this after the imports in your stylesheet:

src/app.css
@import "fumadocs-obsidian/css/preset.css";

Create the Source

press.config.tsx
import { obsidian } from "fumadocs-obsidian";
import obsidianPlugin from "fumadocs-obsidian/press";

const vault = obsidian({
  dir: "public/vault",
  url: (file) => `/vault/${file}`,
});

const plugin = obsidianPlugin({ vault }); 

export default createPress(vault.dynamicSource()).plugins(plugin);

The vault is read when a page renders, so the site needs a server. To prerender the pages instead, pass await vault.staticSource().

Content Updates

Fumapress reads your vault 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 the vault by default. Add the Vite plugin, then connect your vault:

import { localContentPlugin } from "fumadocs-obsidian/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:

press.config.tsx
createPress(source, {
  alwaysRevalidate: true, 
});

Reading on every request works for low traffic. On a busier site, call the webhook when your content changes.

Components

Pass the Fumadocs UI defaults along with your own components, since components replaces the defaults:

press.config.tsx
import defaultMdxComponents from "fumadocs-ui/mdx";

obsidianPlugin({
  vault,
  components: {
    ...defaultMdxComponents,
    img: (props) => <img {...props} className="rounded-xl" />,
  },
});

Options

Prop

Type

For schemas and remark or rehype plugins, like Mermaid and math, see the Fumadocs Obsidian integration.

Last updated on

On this page