Registry / web-framework / vite-plugin-svelte-md

vite-plugin-svelte-md

JSON →
library0.6.0jsnpmunverified

Vite plugin that converts Markdown files into Svelte component templates, enabling use of Svelte components directly within Markdown content. Current stable version is 0.6.0, released in March 2025. The plugin uses markdown-exit (an async-compatible fork of markdown-it) and supports frontmatter with YAML only. It is distributed as ESM-only, requires Node >=20, and works with Vite 3–8. Key differentiators: seamless integration with SvelteKit and Vite, support for Svelte script tags and components inside Markdown, and head tag generation from frontmatter.

npm install vite-plugin-svelte-md
INSTALL
IMPORT
SIG · VITE-PLUGIN-SVELTE
V
vite-plugin-svelte-md
web-frameworkjavascriptv0.6.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import svelteMd from 'vite-plugin-svelte-md'
const svelteMd = require('vite-plugin-svelte-md')
ESM-only since v0.3.0. CommonJS require() will throw an error.

Minimal Vite config with Svelte to process .svelte and .md files using vite-plugin-svelte-md.

import { defineConfig } from 'vite'; import { svelte } from '@sveltejs/vite-plugin-svelte'; import svelteMd from 'vite-plugin-svelte-md'; export default defineConfig({ plugins: [ svelteMd(), svelte({ extensions: ['.svelte', '.md'], }), ], });
Debug
Known issues
breakingESM-only since v0.3.0; Node >=20 required.
fix
Use ESM imports and update Node to 20+.
affects: >=0.3.0
deprecatedReplaced deprecated `context="module"` with `module` attribute in Svelte 5.
fix
Update to v0.6.0 or later.
affects: >=0.6.0
breakingReplaced gray-matter with yaml parser in v0.5.0; JS/JSON frontmatter no longer supported.
fix
Convert frontmatter to YAML format.
affects: >=0.5.0
breakingReplaced markdown-it with markdown-exit in v0.4.0; async plugins now supported.
fix
Update plugins for markdown-exit compatibility if they relied on markdown-it specifics.
affects: >=0.4.0
gotchaMust add '.md' to Svelte plugin's extensions list to process .md files.
fix
Set svelte({ extensions: ['.svelte', '.md'] }) in Vite config.
affects: >=0.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module not supported
Using require() with ESM-only package since v0.3.0.
fix
Switch to import syntax or set type: 'module' in package.json.
Unknown file extension ".md"
.md extension not registered with the Svelte plugin.
fix
Ensure svelte({ extensions: ['.md'] }) is configured.
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies
viterequiredpeer dependency, plugin only works within Vite projects
Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
1
Resources
vite-plugin-svelte-md — npm install vite-plugin-svelte-md · libregistry