Skip to content

Commit 51cfbfa

Browse files
authored
(docs) Clarify video embed syntax (#1138)
1 parent e7c5ae2 commit 51cfbfa

File tree

2 files changed

+41
-21
lines changed

2 files changed

+41
-21
lines changed

fern/products/docs/pages/component-library/writing-content/markdown.mdx

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,40 @@ For example, to embed a video, use the following Markdown:
110110

111111
### Local videos
112112

113-
114113
You can embed videos in your documentation using the HTML `<video>` tag. This gives you control over video playback settings like autoplay, looping, and muting.
115114

115+
<Markdown src="/snippets/html-video-syntax-callout.mdx" />
116+
117+
<Tabs>
118+
<Tab title="Rendered video">
119+
<video
120+
src="./embed-fern-waving.mp4"
121+
width="854"
122+
height="480"
123+
autoPlay
124+
loop
125+
muted
126+
controls
127+
>
128+
</video>
129+
</Tab>
130+
<Tab title="HTML">
116131
```html
117132
<video
118133
src="path/to/your/video.mp4"
119134
width="854"
120135
height="480"
121-
autoplay
136+
autoPlay
122137
loop
123-
playsinline
138+
playsInline
124139
muted
125140
>
126141
</video>
127142
```
128143

144+
</Tab>
145+
</Tabs>
146+
129147
You can also wrap the video in a container div for additional styling:
130148

131149
```html
@@ -134,9 +152,9 @@ You can also wrap the video in a container div for additional styling:
134152
src="path/to/your/video.mp4"
135153
width="854"
136154
height="480"
137-
autoplay
155+
autoPlay
138156
loop
139-
playsinline
157+
playsInline
140158
muted
141159
>
142160
</video>
@@ -149,9 +167,9 @@ Common video attributes:
149167
| --------- | ----------- |
150168
| `src` | URL or path to the video file |
151169
| `width` and `height` | Dimensions of the video player |
152-
| `autoplay` | Video starts playing automatically |
170+
| `autoPlay` | Video starts playing automatically |
153171
| `loop` | Video repeats when finished |
154-
| `playsinline` | Video plays inline on mobile devices instead of fullscreen |
172+
| `playsInline` | Video plays inline on mobile devices instead of fullscreen |
155173
| `muted` | Video plays without sound |
156174
| `controls` | Shows video player controls (play/pause, volume, etc.) |
157175

@@ -163,27 +181,26 @@ For more details about the HTML video element and its attributes, see the [MDN d
163181

164182
You can embed videos from YouTube, Loom, Vimeo, and other streaming platforms using an `<iframe>` element.
165183

184+
<Markdown src="/snippets/html-video-syntax-callout.mdx" />
185+
166186
<Tabs>
167-
<Tab title="YouTube">
168-
```mdx
169-
<iframe
170-
width="100%"
171-
height="450px"
172-
src="https://www.youtube.com/embed/jqBPmGWwt8c?si=3SNDLqnTDqOD-c1P"
173-
frameborder="0"
174-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
175-
referrerpolicy="strict-origin-when-cross-origin"
176-
allowfullscreen
177-
></iframe>
178-
```
187+
<Tab title="Rendered Loom video">
188+
<iframe
189+
src="https://www.loom.com/embed/2e7f038de6894c69bf9c0d2525b0ad7f?sid=8bb327d2-8ba6-413c-a832-8d80282ad527"
190+
width="100%"
191+
height="450px"
192+
frameBorder="0"
193+
allowFullScreen
194+
></iframe>
179195
</Tab>
180-
<Tab title="Loom">
196+
<Tab title="Loom video syntax">
181197
```mdx
182198
<iframe
183199
src="https://www.loom.com/embed/2e7f038de6894c69bf9c0d2525b0ad7f?sid=8bb327d2-8ba6-413c-a832-8d80282ad527"
184200
width="100%"
185201
height="450px"
186-
frameborder="0"
202+
frameBorder="0"
203+
allowFullScreen
187204
></iframe>
188205
```
189206
</Tab>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Warning>
2+
`.mdx` files use JSX syntax, not pure HTML. Attributes for HTML elements like `<video>` and `<iframe>` that are embedded in `.mdx` pages must be written in `camelCase` rather than lowercase. For example, use `autoPlay` instead of `autoplay`.
3+
</Warning>

0 commit comments

Comments
 (0)