Plaindown is a Bun-powered Vite and VitePress plugin that exposes selected .md files as plain Markdown endpoints.
It is built for plain-text publishing and programmatic Markdown access in workflows like AI SEO, GEO, search indexing, content syndication, custom readers, and internal content pipelines.
bun add @itznotabug/plaindownBun is required at runtime.
// .vitepress/config.ts
import { defineConfig } from "vitepress";
import { plaindown } from "@itznotabug/plaindown/plugin";
export default defineConfig({
vite: {
plugins: [
plaindown({
include: ["blog/**/*.md"],
}),
],
},
});With the default format, blog/my-post.md is available at /blog/my-post.md.
import { usePlaindown } from "@itznotabug/plaindown/runtime";
const plain = usePlaindown();
plain.url.value;
plain.url.for("blog/my-post.md");
await plain.load();
await plain.load("blog/my-post.md");
await plain.copy();
await plain.copy("blog/my-post.md");- Publish raw Markdown beside rendered VitePress pages
- Give LLMs, crawlers, and automation tools a stable Markdown source
- Reuse Markdown in-app without making it publicly routable
- Optionally strip frontmatter from emitted files
- Split bundled Markdown into lazy-loaded chunks when
emit: false
plaindown({
enabled: true,
emit: true,
include: ["**/*.md"],
exclude: ["**/drafts/**"],
format: ({ route }) => `${route}.md`,
identifier: ({ sourcePath }) => sourcePath,
stripFrontmatter: false,
experimental: {
chunks: (entry) => entry.dir,
},
});| Option | What it does |
|---|---|
emit |
When true (default): Emits files at build time and serves matching routes in dev.When false: Bundles Markdown into JavaScript so usePlaindown() can load it without public endpoints. |
include / exclude |
Controls which Markdown files are indexed. Default safety exclusions stay in place, including common output directories and Vite build.outDir. |
format |
Controls the public URL. Default: ${route}.md. |
identifier |
Controls how runtime callers reference entries. Default: sourcePath. |
stripFrontmatter |
Removes frontmatter from emitted, served, and bundled content. |
experimental.chunks |
Only for emit: false. Splits bundled Markdown into lazy-loaded chunks. null or undefined falls back to _default. |
- Dev: middleware serves matching Markdown routes with caching
- Build: files are emitted concurrently with bounded IO
- Runtime:
usePlaindown()resolves URLs and loads bundled or fetched Markdown
Bunis required because the plugin uses its APIsexperimental.chunksis intentionally experimental
bun install
bun run typecheck
bun test
bun run build