Process Markdown and Markdoc files into Svelte components using Markdoc. Use Markdoc defaults out of the box or configure Markdoc schema to your needs.
Install markdoc-svelte in your SvelteKit project.
npm install markdoc-svelteAmend your SvelteKit config in svelte.config.js to:
- Process files with the extensions you choose (such as
.mdocand.md). - Include the preprocessor.
import { markdocPreprocess } from "markdoc-svelte";
/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: [".svelte", ".mdoc", ".md"],
preprocess: [markdocPreprocess()],
};See full examples and more options at the markdown-svelte docs.