Skip to content

Commit ca5ff5c

Browse files
docs: discourage embed component for all use cases and fix broken link
- Update warnings to discourage embed for all asset types (not just videos) - Recommend video component for videos, Download component for PDFs, img tag for images - Fix broken link from /learn/docs/content/write-markdown to /learn/docs/writing-content/markdown - Add notes to PDF and video sections with recommended alternatives - Update markdown.mdx to be consistent with embed.mdx warnings Co-Authored-By: Colton Berry <[email protected]>
1 parent 97f2232 commit ca5ff5c

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

fern/products/docs/pages/component-library/default-components/embed.mdx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ Embed local assets like PDFs, videos, and other media directly in your documenta
1313
## Usage (embed video)
1414

1515
<Warning>
16-
The `<embed>` component isn't well-supported on Safari and may cause compatibility issues. For embedding videos, use the `<video>` component instead, which provides better cross-browser support and more control over playback.
16+
The `<embed>` component isn't recommended for use as it has inconsistent browser support, particularly on Safari and mobile browsers. Instead, use the recommended alternatives below for better cross-browser compatibility:
17+
- **Videos**: Use the [`<video>` component](/learn/docs/writing-content/markdown#local-videos)
18+
- **PDFs**: Use the `<Download>` component (see [below](#downloadable-assets))
19+
- **Images**: Use the `<img>` tag or Markdown image syntax
1720
</Warning>
1821

1922
## Properties
@@ -33,17 +36,8 @@ Embed local assets like PDFs, videos, and other media directly in your documenta
3336

3437
### Video file with video tag
3538

36-
<Warning>
37-
The `<embed>` component isn't well-supported on Safari and may cause compatibility issues. For embedding videos, use the [`<video>` component](/learn/docs/content/write-markdown#embedding-videos) instead, which provides better cross-browser support and more control over playback. Additionally, videos with audio will automatically play when the page loads with `<embed>`.
38-
</Warning>
39-
40-
</Tab>
41-
<Tab title="Example using `<video>`">
42-
<video style={{ aspectRatio: '16 / 9', width: '100%' }} controls>
43-
<source src="./growing-fern.mp4" type="video/mp4" />
44-
</video>
4539
<Note>
46-
Videos with audio will automatically play when the page loads. Using [`<video>` component](/learn/docs/content/write-markdown#embedding-videos) disables this behavior and provides more control over playback.
40+
The `<video>` component is the recommended approach for embedding videos, providing better cross-browser support and more control over playback. Using [`<video>` component](/learn/docs/writing-content/markdown#local-videos) prevents videos with audio from automatically playing when the page loads.
4741
</Note>
4842

4943
<div className="highlight-frame">
@@ -60,6 +54,10 @@ Embed local assets like PDFs, videos, and other media directly in your documenta
6054

6155
### PDF document
6256

57+
<Note>
58+
For PDFs, use the `<Download>` component (see [below](#downloadable-assets)) instead of `<embed>` for better cross-browser compatibility, especially on mobile devices.
59+
</Note>
60+
6361
<div className="highlight-frame">
6462
<embed src="./all-about-ferns.pdf" type="application/pdf" width="100%" height="500px" />
6563
</div>
@@ -127,5 +125,3 @@ Enable users to download assets from within your documentation, instead of linki
127125

128126
<br />
129127
<br />
130-
131-

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,21 @@ For more details about the HTML image element and its attributes, see the [MDN d
110110

111111
## Embedding local assets
112112

113-
You can embed local assets in your Markdown pages using the [`<embed>` component](/learn/docs/content/components/embed). This is useful for displaying PDFs, images, videos, OpenAPI files, and other assets into your docs.
113+
You can embed local assets in your Markdown pages using the [`<embed>` component](/learn/docs/writing-content/components/embed). However, the `<embed>` component isn't recommended for use due to inconsistent browser support.
114114

115-
For example, to embed a video, use the following Markdown:
115+
<Warning>
116+
The `<embed>` component isn't recommended for use as it has inconsistent browser support, particularly on Safari and mobile browsers. Instead, use these recommended alternatives:
117+
- **Videos**: Use the `<video>` component (see [below](#local-videos))
118+
- **PDFs**: Use a download link or the `<Download>` component
119+
- **Images**: Use the `<img>` tag or Markdown image syntax
120+
</Warning>
121+
122+
For example, if you need to embed a video, use the `<video>` component instead:
116123

117124
```mdx
118-
<embed src="./path/to/asset.mp4" type="video/mp4" />
125+
<video src="./path/to/asset.mp4" controls />
119126
```
120127

121-
<embed src="./embed-fern-waving.mp4" type="video/mp4" width="640px" height="360px" />
122-
123-
<Warning>
124-
The `<embed>` component isn't well-supported on Safari and may cause compatibility issues. For embedding videos, use the `<video>` component instead (see below), which provides better cross-browser support and more control over playback.
125-
</Warning>
126-
127128
### Local videos
128129

129130
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.

0 commit comments

Comments
 (0)