diff --git a/mdsvex.config.js b/mdsvex.config.js deleted file mode 100644 index 5576a98..0000000 --- a/mdsvex.config.js +++ /dev/null @@ -1,3 +0,0 @@ -export default { - extensions: ['.md'] -}; diff --git a/src/lib/components/MdsvexLayout.svelte b/src/lib/components/MdsvexLayout.svelte new file mode 100644 index 0000000..061e2b2 --- /dev/null +++ b/src/lib/components/MdsvexLayout.svelte @@ -0,0 +1,11 @@ + + + + +{@render children()} diff --git a/svelte.config.js b/svelte.config.js index ebf0dc8..8bcc2c3 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,8 +1,13 @@ import adapter from '@sveltejs/adapter-static'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; import { mdsvex } from 'mdsvex'; -import mdsvexConfig from './mdsvex.config.js'; import autoImport from 'sveltekit-autoimport'; +import { join, dirname } from 'path'; +import { fileURLToPath } from 'url'; + +// https://flaviocopes.com/fix-dirname-not-defined-es-module-scope/ +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -34,7 +39,10 @@ const config = { extensions: ['.svelte', '.md'], preprocess: [ vitePreprocess(), - mdsvex(mdsvexConfig), + mdsvex({ + extensions: ['.md'], + layout: join(__dirname, "./src/lib/components/MdsvexLayout.svelte") + }), autoImport({ include: ['**/*.(svelte|md)'], components: ['./src/lib/components/', { name: './src' }]