JSPM

@itznotabug/plaindown

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1522
  • Score
    100M100P100Q98447F
  • License Apache-2.0

A Vite/VitePress plugin that emits plain Markdown endpoints

Package Exports

  • @itznotabug/plaindown/plugin
  • @itznotabug/plaindown/runtime

Readme

Plaindown

npm version License CI Previews Vite VitePress TypeScript Bun Built with Claude Reviewed by Codex

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.

Install

bun add @itznotabug/plaindown

Bun is required at runtime.

Quick Start

// .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.

Runtime

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");

Why Use It

  • 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

Core Options

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.

How It Works

  • 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

Notes

  • Bun is required because the plugin uses its APIs
  • experimental.chunks is intentionally experimental

Development

bun install
bun run typecheck
bun test
bun run build