Obsidian
Publish an Obsidian vault as a docs site.
Fumapress renders your vault with its wikilinks, embeds, callouts, block IDs and comments.
For a working project, see examples/obsidian.
Setup
Install the Package
npm i fumadocs-obsidianAdd the Styles
Add this after the imports in your stylesheet:
@import "fumadocs-obsidian/css/preset.css";Create the Source
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({
plugins: [
press(),
localContentPlugin(),
tailwindcss(),
],
});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.
Components
Pass the Fumadocs UI defaults along with your own components, since components replaces the defaults:
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