site: render markdown file as string

This commit is contained in:
Glen Huang
2025-10-06 20:27:51 +08:00
committed by Johannes Kirschbauer
parent 25db58ce11
commit 70523f75fa
5 changed files with 22 additions and 23 deletions

View File

@@ -1,6 +1,16 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [sveltekit()]
plugins: [
sveltekit(),
{
name: "markdown-loader",
transform(code, id) {
if (id.slice(-3) === ".md") {
return `export default ${JSON.stringify(code)};`;
}
},
},
],
});