From b6bbb42cf43a39bb0cd5f26102abaec770c6aa95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Tue, 18 Oct 2022 14:55:53 +0200 Subject: [PATCH] docs: no need to register manually nitro plugin --- docs/content/4.api/4.advanced.md | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/docs/content/4.api/4.advanced.md b/docs/content/4.api/4.advanced.md index 5482bc1cc..acea8db87 100644 --- a/docs/content/4.api/4.advanced.md +++ b/docs/content/4.api/4.advanced.md @@ -12,24 +12,14 @@ The module adds some hooks you can use: `content:file:*` hooks are available in nitro runtime, in order to use them you need to create a custom [nitro plugin](https://nitro.unjs.io/guide/plugins.html). -- Create a plugin in the `server/plugins/` directory +Create a plugin in the `server/plugins/` directory - ```ts [server/plugins/content.ts] - export default defineNitroPlugin((nitroApp) => { - // ... - }) - ``` - -- Register the plugin in `nuxt.config.ts` +```ts [server/plugins/content.ts] +export default defineNitroPlugin((nitroApp) => { + // ... +}) +``` - ```ts [nuxt.config.ts] - export default defineNuxtConfig({ - // ... - nitro: { - plugins: ['~/server/plugins/content.ts'] - } - }) - ``` ### `content:file:beforeParse` @@ -44,8 +34,7 @@ Arguments: ### Example -Changing all occurrences of react to vue in all Markdown files: - +Changing all occurrences of React to Vue in all Markdown files: ```ts [server/plugins/content.ts] export default defineNitroPlugin((nitroApp) => {