A Vite plugin that lets you write pure Markdown without frontmatter. It derives
the title (and optional description) from the document's own content at
build time.
Works great with Astro Starlight but is not tied to it.
pnpm add -D vite-plugin-nomatter// astro.config.mjs
import { defineConfig } from 'astro/config'
import starlight from '@astrojs/starlight'
import nomatter from 'vite-plugin-nomatter'
export default defineConfig({
vite: {
plugins: [
nomatter({
// default options
extensions: ['.md', '.markdown'],
contentDir: 'src/content/docs',
descriptionLength: 150,
stripHeading: true,
meta: {
draft: false,
},
})
]
},
integrations: [
starlight({ title: 'My Docs' })
]
})nomatter(options?)
| Option | Type | Default | Description |
|---|---|---|---|
extensions |
string[] |
['.md', '.markdown'] |
File extensions to process |
contentDir |
string |
'src/content/docs' |
Only files under this path segment are processed |
descriptionLength |
number |
160 |
Maximum character length for the extracted description |
stripHeading |
boolean |
true |
Remove the h1 from the body after extracting the title |
meta |
Record<string, unknown> |
{} |
Additional frontmatter fields to inject into every file |
This work is licensed under The MIT License.