Skip to content

Commit e88ff3f

Browse files
devin-ai-integration[bot]coltondotiodevalog
authored
Discourage embed component usage for all asset types (#1721)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Colton Berry <coltonsberry@gmail.com> Co-authored-by: Devin Logan <devinannlogan@gmail.com>
1 parent 28806b7 commit e88ff3f

File tree

6 files changed

+62
-132
lines changed

6 files changed

+62
-132
lines changed

fern/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ redirects:
303303
destination: /learn/docs/writing-content/components/accordions
304304
- source: /learn/docs/writing-content/components/card-groups
305305
destination: /learn/docs/writing-content/components/cards
306+
- source: /learn/docs/writing-content/components/embed
307+
destination: /learn/docs/writing-content/components/download
306308
- source: /learn/docs/building-and-customizing-your-docs/navigation
307309
destination: /learn/docs/configuration/navigation
308310
- source: /learn/docs/navigation/overview

fern/products/docs/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ navigation:
6767
path: ./pages/component-library/default-components/code-blocks.mdx
6868
icon: fa-duotone fa-code
6969
slug: code-blocks
70-
- page: Embed
71-
path: ./pages/component-library/default-components/embed.mdx
72-
icon: fa-duotone fa-window-restore
70+
- page: Download
71+
path: ./pages/component-library/default-components/download.mdx
72+
icon: fa-duotone fa-download
7373
- page: Endpoint request snippet
7474
path: ./pages/component-library/default-components/endpoint-request-snippet.mdx
7575
icon: fa-duotone fa-arrow-up
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: "Download"
3+
description: "Download assets like PDFs directly from your documentation"
4+
---
5+
6+
The `<Download>` component lets users download assets like PDFs directly from your documentation.
7+
8+
<Info>
9+
For information on how to embed assets, check out the documentation on [Images](/learn/docs/writing-content/markdown#images), [PDFs](/learn/docs/writing-content/markdown#pdfs), and [Videos](/learn/docs/writing-content/markdown#videos).
10+
</Info>
11+
12+
## Usage
13+
14+
<div className="highlight-frame">
15+
<Download src="./all-about-ferns.pdf">
16+
<Button intent="primary">Download PDF</Button>
17+
</Download>
18+
</div>
19+
20+
```jsx Markdown
21+
<Download src="./all-about-ferns.pdf">
22+
<Button intent="primary">Download PDF</Button>
23+
</Download>
24+
```
25+
26+
## Properties
27+
28+
<ParamField path="src" type="string" required={true}>
29+
Path to your local asset (relative to current MDX file). The asset must be located within the `fern` folder.
30+
</ParamField>
31+
32+
<ParamField path="children" type="React.ReactNode" required={true}>
33+
The text or element to display as the click target for the download.
34+
</ParamField>
35+
36+
<ParamField path="filename" type="string">
37+
The filename to use for the downloaded asset. If not provided, the filename will be the same as the asset's name.
38+
</ParamField>

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

Lines changed: 0 additions & 115 deletions
This file was deleted.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ Fern includes 20 built-in components for creating interactive documentation. Sel
6363
Code examples with syntax highlighting and interactive features
6464
</Card>
6565
<Card
66-
title="Embed"
67-
icon="fa-duotone fa-window-restore"
68-
href="/docs/writing-content/components/embed"
66+
title="Download"
67+
icon="fa-duotone fa-download"
68+
href="/docs/writing-content/components/download"
6969
>
70-
Embedded local assets like PDFs, videos, and other media
70+
Download PDFs and other assets
7171
</Card>
7272
<Card
7373
title="Endpoint request snippet"

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Read the [Introduction](/learn/overview/introduction).
6767

6868
## Images
6969

70-
You can use locally stored images or URLs to include images in your Markdown pages. Use either [Markdown syntax](https://www.markdownguide.org/basic-syntax/#images-1) or the [`<img>` HTML tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) to insert the image.
70+
You can use locally stored images or URLs to include images in your Markdown pages. Use either [Markdown syntax](https://www.markdownguide.org/basic-syntax/#images-1) or the [`<img>` HTML tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) to insert the image. Don't use the `<embed>` element, as it has inconsistent browser support.
7171

7272
<Info title="Image paths">
7373
You can reference images using paths relative to the page's location (using `./` or `../`) or relative to the `fern` folder root (using `/`). For example, an image at `fern/assets/images/logo.png` can be referenced from any page as `/assets/images/logo.png`.
@@ -108,21 +108,26 @@ Common image attributes:
108108
For more details about the HTML image element and its attributes, see the [MDN documentation on the img element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img).
109109
</Note>
110110

111-
## Embedding local assets
111+
## PDFs
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+
Embed PDFs using the `<iframe>` element. Don't use the `<embed>` element, as it has inconsistent browser support.
114114

115-
For example, to embed a video, use the following Markdown:
116-
117-
```mdx
118-
<embed src="./path/to/asset.mp4" type="video/mp4" />
115+
<Tabs>
116+
<Tab title="Rendered video">
117+
<iframe src="../default-components/all-about-ferns.pdf" width="100%" height="500px" style={{ border: 'none', borderRadius: '0.5rem' }} />
118+
</Tab>
119+
<Tab title="HTML">
120+
```html
121+
<iframe src="../default-components/all-about-ferns.pdf" width="100%" height="500px" style={{ border: 'none', borderRadius: '0.5rem' }} />
119122
```
123+
</Tab>
124+
</Tabs>
120125

121-
<embed src="./embed-fern-waving.mp4" type="video/mp4" width="640px" height="360px" />
126+
## Videos
122127

123128
### Local videos
124129

125-
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.
130+
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. Don't use the `<embed>` element, as it has inconsistent browser support.
126131

127132
<Markdown src="/snippets/html-video-syntax-callout.mdx" />
128133

@@ -189,7 +194,7 @@ Common video attributes:
189194
For more details about the HTML video element and its attributes, see the [MDN documentation on the video element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video).
190195
</Note>
191196

192-
## Embed YouTube or Loom videos
197+
### Embed YouTube or Loom videos
193198

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

0 commit comments

Comments
 (0)