Two ways to read Markdown
mdsvex compiles .md into Svelte components at build time. That is useful when Markdown needs to include Svelte components. It is less useful when you only need HTML from a file at runtime.
mdsvex approach
- Markdown files are imported as components.
- Frontmatter is available as
metadata. - Body renders as a component, not a string.
Raw approach
- Markdown files are imported with
?raw. - Frontmatter is parsed with a YAML parser.
- Body is parsed with a Markdown parser like
marked. - Body renders with
{@html}.
Which one fits
If content needs Svelte components, use mdsvex. If content is plain Markdown and you want a string, use ?raw and a parser. Mixing both is fine, as long as collections stay separate.
Summary
Pick one approach per collection. Do not mix them in the same folder. That keeps loaders predictable and content editable.