Closed rdela closed 2 years ago
Cc @vedam @arxpoetica @LorbusChris
I took a quick glance at the MD parsing here and it looks like markdown files are parsed and stored as JSON. This won't work with MDsveX because MDsveX is just a preprocessor, it converts the file into a valid Svelte component that needs to be instantiated like a normal component. I assume Scant creates a little API from which it loads the JSON, I think that would need to be modified for it to work with MDsveX.
All this said, (hopefully) Sapper will have custom route extensions soon and you'll esentially be able to build a static site that also allows md/mdx files as routes file (which will become pages). I don't know about the efficiency trade-offs between loading a blob of JSON and sticking it in a page, and instantiating a new component so I won't comment on that but it will be possible.
Cc @lukeed 🐧.svex
I really like this idea. At first glance the problem to solve would be how to get posts routed without having to configure a route for every single blog post.
Prior art from https://github.com/sveltejs/sapper-template/tree/blog-from-markdown-files (this branch is still on Svelte v2):
"create blog posts from markdown files" commit https://github.com/sveltejs/sapper-template/commit/0fa6c9f7d7ca0933370a985e1178df3754eb8ce7
Instead of route masking, we encode route parameters in filenames. For example, the page you're looking at right now is routes/blog/[slug].html https://github.com/sveltejs/sapper-template/compare/blog-from-markdown-files#diff-a6d0899ae6f137aa7c93bd2fe6f0ccf6R9
Comparison against current sapper-template master: https://github.com/sveltejs/sapper-template/compare/blog-from-markdown-files
I just added a commit on a PR I had open on the blog-from-markdown-files
branch to bring it up to Svelte v3 and Sapper v0.27.
PR: https://github.com/sveltejs/sapper-template/pull/109 Code: https://github.com/rdela/sapper-template/tree/discordian-blog-from-markdown-files
https://github.com/pngwn/MDsveX
Sapper: Add support for custom route file extensions https://github.com/sveltejs/sapper/pull/632
Alternatively, focus efforts on Sapper? https://twitter.com/Rich_Harris/status/1128822261815894016
Although, as I understand it, Scant has a more ambitious scope, wanting to support a plugin system and other things that Sapper does not currently provide. @voldemortensen thoughts?
Cc @pngwn @mrkishi @Conduitry @Rich-Harris