问题
I am creating a blog using Sapper using the default sapper-template-rollup.
In the blog folder, it does mention about generating data from markdown files. But I can't find how to do it?
回答1:
You may find this repo helpful. I also have an open PR on the Sapper Template repo, first revising the old Markdown branch in Jan. 2019 and then adding Svelte 3 support in May 2019, but it is probably easier to look at and clone my repo on GitLab, plus it has more current dependency updates I have not added to the PR yet.
回答2:
You might have more lick using MDsveX which is a Svelte Markdown processor, created by one of the core community members.
However yes, you can also just use marked
or snarkdown
(which is what I use), the same way as you would use any other library - simply import it and pass your markdown code to it.
来源:https://stackoverflow.com/questions/58417881/sapper-svelte-how-do-i-add-markdown-files