You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module uses [remark][remark] and [rehype][rehype] under the hood to compile markdown files into JSON AST that will be stored into the body variable.
95
+
This module uses [remark](https://github.com/remarkjs/remark) and [rehype](https://github.com/remarkjs/remark-rehype) under the hood to compile markdown files into JSON AST that will be stored into the body variable.
97
96
98
-
> The following explanation is valid for both `remarkPlugins` and `rehypePlugins`
99
-
100
-
To configure how the module will parse Markdown, you can:
101
-
102
-
- Add a new plugin to the defaults:
97
+
To configure how the module will parse Markdown, you can use `markdown.remarkPlugins` and `markdown.rehypePlugins` in your `nuxt.config.ts` file:
103
98
104
99
```ts [nuxt.config.ts]
105
100
exportdefaultdefineNuxtConfig({
106
101
content: {
107
102
markdown: {
108
-
remarkPlugins: ['remark-emoji']
109
-
}
110
-
}
111
-
})
112
-
```
113
-
114
-
- Override the default plugins:
115
103
116
-
```ts [nuxt.config.ts]
117
-
exportdefaultdefineNuxtConfig({
118
-
content: {
119
-
markdown: {
120
-
remarkPlugins: () => ['remark-emoji']
121
-
}
122
-
}
123
-
})
124
-
```
125
-
126
-
- Use local plugins:
104
+
// Object syntax can be used to override default options
105
+
remarkPlugins: {
106
+
// Override remark-emoji options
107
+
'remark-emoji': {
108
+
emoticon: true
109
+
},
110
+
111
+
// Disable remark-gfm
112
+
'remark-gfm': false,
113
+
114
+
// Add remark-oembed
115
+
'remark-oembed': {
116
+
// Options
117
+
}
118
+
},
127
119
128
-
```ts [nuxt.config.ts]
129
-
exportdefaultdefineNuxtConfig({
130
-
content: {
131
-
markdown: {
132
-
remarkPlugins: [
133
-
'~/plugins/my-custom-remark-plugin.js'
120
+
// Array syntax can be used to add plugins
121
+
rehypePlugins: [
122
+
'rehype-figure'
134
123
]
135
124
}
136
125
}
137
126
})
138
127
```
139
128
140
-
- Provide options directly in the definition:
141
-
142
-
```ts [nuxt.config.ts]
143
-
exportdefaultdefineNuxtConfig({
144
-
content: {
145
-
markdown: {
146
-
remarkPlugins: [
147
-
['remark-emoji', { emoticon: true }]
148
-
]
149
-
}
150
-
}
151
-
})
152
-
```
129
+
> [Here](https://github.com/nuxt/content/tree/main/src/runtime/markdown-parser/index.ts#L23) is a list of plugins @nuxt/content is using by default.
153
130
154
131
> When adding a new plugin, make sure to install it in your dependencies.
155
132
@@ -234,8 +211,3 @@ List of locale codes. This codes will be used to detect contents locale.
234
211
- Default: `undefined`{lang=ts}
235
212
236
213
Default locale for top level contents. Module will use first locale code from `locales` array if this option is not defined.
0 commit comments