Closed spences10 closed 4 weeks ago
Interesting. I assume that we are not adding this, because it's not part of the docs: https://mdsvex.pngwn.io/docs. This is because mdsvex
& kit
need to understand that new file extension. In your first try you only told kit
about the new extension, but not mdsvex
Instead of adding a whole new mdsvex
config, you can just pass the extensions
property to your mdsvex
call in svelte.config.js
, leaving you with something like this:
import { mdsvex } from 'mdsvex';
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [vitePreprocess(), mdsvex({ extensions: ['.svx', 'md'] })],
// boring kit stuff
extensions: ['.svelte', '.svx', '.md']
};
export default config;
extensions have to be added to the svelte config vite-plugin-svelte uses. as sveltekit currently does not expose a way for users to do this and other tools also need to be aware of custom extensions, svelte.config.js is the best way i know of today.
so you'd include .svelte, .svx and .md in svelte.config extensions but only .md and .svx in mdsvex.config.js extensions
Been playing around with this and love it! Thanks!
I found the
mdsvex
config isn't quite working as expected for me, not sure if others see this behaviourNew project created with the CLI:
Then added in mdsvex:
svelte.config.js
Replaced the
+page.svelte
with+page.md
so realised that I needed to add'.md'
to theextensions
array.Thing is though, that didn't render the markdown on the page, so I added a
mdsvex.config.js
file:This also has an
extensions
array, but if I comment out here the md isn't rendered, comment out on thesvelte.config.js
then the page isn't renderedAm I missing something here or do we now need to have two sets of
extensions
defined?LMK if you would like a minimal repo, it's those steps though