Skip to content

Commit

Permalink
docs: costum components (#2433)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukszy committed Nov 22, 2023
1 parent 7bf8996 commit e99967d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docs/content/4.components/2.content-renderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,28 @@ const { data } = await useAsyncData('page-data', () => queryContent('/hello').fi
::callout{type="info"}
Note that when you use default slot and `<ContentRendererMarkdown>` in your template you need to pass `components` to `<ContentRendererMarkdown>`.

```html [components/CustomParagraph.vue]
<template>
<div>
<ContentSlot :use="$slots.default" unwrap="p" />
</div>
</template>
```

```md [content/index.md]
::custom-p
this is my custom paragraph
::
```

```html [pages/[...slug\\].vue]
<script setup lang="ts">
import { CustomParagraph } from '#components';
const { data } = await useAsyncData('page-data', () => queryContent('/hello').findOne())
const components = {
p: 'CustomParagraph'
'custom-p': CustomParagraph
}
</script>

Expand Down

0 comments on commit e99967d

Please sign in to comment.