Overview
svelte-markdoc is a preprocessor for Svelte that allows users to create pages with the .markdoc extension. It is a more constrained editing system where documentation is treated as data, making it different from MDX.
Features
- Svelte integration
- Support for creating pages with .markdoc extension
- Constrained editing system for documentation
Installation
To use svelte-markdoc, follow these steps:
- Create a SvelteKit project.
- Install the svelte-markdoc package.
- Create a markdoc.config.js file in the root folder to hold your markdoc config.
- Configure the preprocessor in svelte.config.js.
- Create pages with the .markdoc extension in src/routes.
Here is an example of how to configure the preprocessor in svelte.config.js:
import { svelteMarkdoc } from 'svelte-markdoc';
export default {
preprocess: [svelteMarkdoc()],
};
Summary
svelte-markdoc is a useful preprocessor for Svelte that allows users to create pages with the .markdoc extension. It provides a more constrained editing system for documentation compared to MDX and integrates well with SvelteKit projects. With svelte-markdoc, users can easily manage and display their documentation as data within their Svelte applications.