Options
The options are passed to the mdxPreprocess
function.
extensions
- Optional
- Type:
string[]
- Default:
[".md"]
Include the extension of files to be preprocessed and transformed. Don't include the .svelte
extension.
Add custom extensions
IMPORTANT
Whatever value you add to the extensions
option, it must be added to the config.extensions
too.
elements
- Optional
- Type:
string[] | { [x: string]: string[] }
This option is useful for replacing markdown elements with custom components.
By using an array, all components inside it with be applied to all markdown files.
svelte.config.js
:
+layout.svelte
:
A getContext
will be preprocessed to all of the markdown files to receive the value of mdxElements
.
Custom layouts
You can use different components for different collections like posts, documentation, etc.
As an example, let's create a layout named posts
:
Add the following property into the frontmatter of a markdown file of a posts
collection:
preprocessDependencies
- Optional
- Type:
string[]
- Default:
[]
Preprocess of the files located in the node_modules
folder are disabled by default. Include the name of the packages to be preprocessed.
onFileIgnore
NOTE
Please refer to the jsDoc comments to learn more.
onTransform
Example usage.
NOTE
Please refer to the jsDoc comments to learn more.