pngwn / MDsveX

A markdown preprocessor for Svelte.
https://mdsvex.pngwn.io
MIT License
2.27k stars 96 forks source link

Does mdsvex have any breaking change for SvelteKit 1.0.0? #468

Open shinokada opened 1 year ago

shinokada commented 1 year ago

While reading https://github.com/sveltejs/kit/discussions/5774, I wondered if I have to update or change for mdsvex.

ashfidable commented 1 year ago

It is still working. All you have to do is make the folder (something like hello-world) and create +page.md(or svx, whatever extension you want for mdx) then start writing markdown like before.

kitesi commented 1 year ago

If you're using mdsvex for a blog, and don't want individual folders for each blogs you can create a slug, and have a +page.svelte to serve the markdown. Here's an article on it: https://joshcollinsworth.com/blog/build-static-sveltekit-markdown-blog#approach-2-dynamic-routes

pngwn commented 1 year ago

I'm currently looking into a simple solution for kit + mdsvex atm after the new routing changes. Im not happy with how much boilerplate is required.

easyfrog commented 1 year ago

MDsveX is cool!

And how to use it in Astro ? [svelte + md + island] 👻

einarpersson commented 1 year ago

If you're using mdsvex for a blog, and don't want individual folders for each blogs you can create a slug, and have a +page.svelte to serve the markdown. Here's an article on it: https://joshcollinsworth.com/blog/build-static-sveltekit-markdown-blog#approach-2-dynamic-routes

This was really a great tutorial illustrating various approaches to using MDsveX and SvelteKit, after the big router changes. Consider adding this as a recommended resource in the README.md?

babakfp commented 1 year ago

@pngwn

Please pin this issue so other users can find it easily.

shinokada commented 1 year ago

I have src/routes/+layout-toc.svelte and I extend it in src/routes/layouts/component/+page@toc.svelte.

And adding this to `mdsvex.config.js:

...
const config = defineConfig({
    layout: {
        componentLayout: './src/routes/layouts/component/+page@toc.svelte',
...

In a md file, I try to use it:

---
layout: componentLayout
...
---

But it uses the default +layout.svelte.

How can I use an extended layout?

zmre commented 1 year ago

Any updates on this? Would love the pre processor to automatically turn myblog.md into myblog/+page.svelte if that's possible and was what you were thinking when talking about ditching boilerplate.

pngwn commented 11 months ago

Its very difficult unfortunately, svelte kit doesn't allow you to hook into the router in anyway, and it is only interested in folders. As mdsvex is just a preprocessor, it needs the build system to actually find the file in order to do anything.

Solving this problem will require a complex integration, or something built on top of kit.