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
To display a code block with he's preview, use the `code-preview` component. Write the code to be previewed in a the `default` slot and the actual code in the `code` slot.
description: Add image, video, and other HTML elements
4
+
---
5
+
6
+
## Image
7
+
8
+
### Using Markdown
9
+
10
+
::code-preview
11
+

12
+
13
+
#code
14
+
15
+
```mdc
16
+

17
+
```
18
+
19
+
::
20
+
21
+
Or with your local images
22
+
23
+
::code-preview
24
+

25
+
26
+
#code
27
+
28
+
```mdc
29
+

30
+
```
31
+
32
+
::
33
+
34
+
::note
35
+
If [`@nuxt/image`](https://image.nuxt.com/get-started/installation) is installed, the `<NuxtImg>` component will be used instead of the native `img` tag.
36
+
::
37
+
38
+
### Using Embeds
39
+
40
+
To get more customizability with images, you can also use embeds to add images
41
+
42
+
::code-preview
43
+
<imgsrc="https://nuxt.com/new-social.jpg"alt="Nuxt Social Image"height="150">
44
+
45
+
#code
46
+
47
+
```mdc
48
+
<img src="https://nuxt.com/new-social.jpg" alt="Nuxt Social Image" height="150">
49
+
```
50
+
51
+
::
52
+
53
+
## Embeds and HTML elements
54
+
55
+
You can also use embeds to add videos, iframes, etc.
56
+
57
+
::code-preview{class="[&>div]:*:w-full"}
58
+
<iframewidth="100%"height="100%"src="https://www.youtube-nocookie.com/embed/_eQxomah-nA?si=pDSzchUBDKb2NQu7"title="YouTube video player"frameborder="0"allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"referrerpolicy="strict-origin-when-cross-origin"allowfullscreenstyle="aspect-ratio: 16/9;"class="rounded-[calc(var(--ui-radius)*1.5)]"></iframe>
0 commit comments