Skip to content

Commit 3fdf887

Browse files
committed
docs: replace mdcslot docs with native <slot />
1 parent d77177e commit 3fdf887

File tree

5 files changed

+17
-40
lines changed

5 files changed

+17
-40
lines changed

docs/app/components/example/ExampleAlert.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ defineProps({
1212
class="alert"
1313
:class="[type]"
1414
>
15-
<MDCSlot
16-
:use="$slots.default"
17-
unwrap="p"
18-
/>
15+
<slot mdc-unwrap="p" />
1916
</div>
2017
</template>
2118

docs/app/components/example/ExampleHero.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<section class="pt-4">
33
<h1 class="text-4xl">
4-
<MDCSlot unwrap="p" />
4+
<slot mdc-unwrap="p" />
55
</h1>
66
<slot name="description" />
77
</section>
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<template>
22
<h1 class="text-4xl">
3-
<MDCSlot
4-
:use="$slots.default"
5-
unwrap="p"
6-
/>
3+
<slot mdc-unwrap="p" />
74
</h1>
85
</template>

docs/content/docs/3.files/1.markdown.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,7 @@ Components that are used in Markdown has to be marked as `global` in your Nuxt a
153153

154154
Block components are components that accept Markdown content or another component as a slot.
155155

156-
The component must contain either:
157-
158-
- A `<slot />` to accept raw text or another component.
159-
- The [`<MDCSlot />`](/docs/components/mdc-slot) component to accept formatted text.
156+
The component must contain at least one `<slot />` component to accept formatted text.
160157

161158
In a markdown file, use the component with the `::` identifier.
162159

@@ -204,7 +201,7 @@ This will be rendered inside the `description` slot.
204201
<template>
205202
<section>
206203
<h1 class="text-4xl">
207-
<MDCSlot unwrap="p" />
204+
<slot mdc-unwrap="p" />
208205
</h1>
209206
<slot name="description" />
210207
</section>
@@ -222,7 +219,7 @@ This will be rendered inside the `description` slot.
222219
::
223220

224221
::note
225-
Read more about the [`<MDCSlot />`](/docs/components/mdc-slot) component.
222+
Read more about the [`<slot />`](/docs/components/slot) component.
226223
::
227224

228225
::tip
@@ -238,7 +235,7 @@ You can use Markdown inside your components slots:
238235
```html [MyTitle.vue]
239236
<template>
240237
<h1 class="text-4xl">
241-
<MDCSlot unwrap="p" />
238+
<slot mdc-unwrap="p" />
242239
</h1>
243240
</template>
244241
```
@@ -273,7 +270,7 @@ defineProps(['type'])
273270
274271
<template>
275272
<div :class="[type]">
276-
<MDCSlot :use="$slots.default" unwrap="p" />
273+
<slot mdc-unwrap="p" />
277274
</div>
278275
</template>
279276
```

docs/content/docs/4.components/1.mdc-slot.md renamed to docs/content/docs/4.components/1.slot.md

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
---
2-
title: MDCSlot
2+
title: slot
33
description: The fastest way to inject Markdown into your Vue components.
44
---
55

6-
::warning
7-
We recommend using `<slot>` as much as possible an only use `<MDCSlot>` when you need unwrapping which is not covered by MDC defaults.
8-
::
9-
10-
The `<MDCSlot>` is an extension of the [`<slot>`](https://vuejs.org/guide/components/slots.html) component that makes it easier to render and manipulate Markdown content within your Vue components.
11-
12-
::note
13-
This component is part of [`@nuxtjs/mdc`](https://github.com/nuxt-modules/mdc).
14-
::
6+
When you write contents and paragraphs inside a component with the MDC syntax, you can use Vue's `<slot>` component to render the content.
157

168
## Usage
179

18-
This component is a replacement for Vue's `<slot>` component, specifically designed for MDC.
19-
20-
Use the `<MDCSlot>` component instead of the native `<slot>` component:
10+
If you don't want to modify the rendered content, simply use Vue's `<slot>` component.
2111

2212
```vue [components/content/Callout.vue]
2313
<template>
2414
<div class="callout">
25-
<!-- similar to <slot /> -->
26-
<MDCSlot />
15+
<slot />
2716
</div>
2817
</template>
2918
```
@@ -48,14 +37,14 @@ This usage would be similar to using the native `<slot>` component.
4837

4938
### Unwrapping
5039

51-
The `unwrap` prop allows you to remove one or multiple wrapping elements from the rendered content. This is useful when you want to extract the content nested in native Markdown syntax. Each specified tag will get removed from AST.
40+
The `mdc-unwrap` prop allows you to remove one or multiple wrapping elements from the rendered content. This is useful when you want to extract the content nested in native Markdown syntax. Each specified tag will get removed from AST.
5241

5342
Let's unwrap the `<p>` element from the previous example:
5443

5544
```vue [components/content/Callout.vue]
5645
<template>
5746
<div class="callout">
58-
<MDCSlot unwrap="p" />
47+
<slot mdc-unwrap="p" />
5948
</div>
6049
</template>
6150
```
@@ -78,9 +67,9 @@ Let's improve our `Callout` component to have a `title` slot:
7867
<template>
7968
<div class="callout">
8069
<h2 v-if="$slots.title">
81-
<MDCSlot :use="$slots.title" unwrap="p" />
70+
<slot name="title" mdc-unwrap="p" />
8271
</h2>
83-
<MDCSlot :use="$slots.default" />
72+
<slot />
8473
</div>
8574
</template>
8675
```
@@ -109,10 +98,7 @@ When not using the `title` slot, the `h2` element will not be rendered.
10998

11099
## Props
111100

112-
- `use`: The slot to bind on, you must provide a `use` via `$slots.{your_slot}` in `<template>`.
113-
- **Type:** Vue slot `Function`
114-
- **Example:** `$slots.default`
115-
- `unwrap`: Whether to unwrap the content or not. This is useful when you want to extract the content nested in native Markdown syntax. Each specified tag will get removed from AST.
101+
- `mdc-unwrap`: Whether to unwrap the content or not. This is useful when you want to extract the content nested in native Markdown syntax. Each specified tag will get removed from AST.
116102
- **Type:** `boolean` or `string`
117103
- **Default:** `false`
118104
- **Example:** `'p'` or `'ul li'`

0 commit comments

Comments
 (0)