Skip to content

Commit 3694999

Browse files
committed
minor edits for clarity
1 parent ead7c06 commit 3694999

File tree

1 file changed

+14
-12
lines changed
  • fern/products/docs/pages/component-library/writing-content

1 file changed

+14
-12
lines changed

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,27 @@ Read the [Introduction](/learn/overview/introduction).
6969

7070
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.
7171

72+
<Info title="Image paths">
73+
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`.
74+
</Info>
75+
7276
<Tabs>
7377
<Tab title="Markdown">
7478
```markdown
75-
![Alt text](./path/to/image.png "Optional title")
79+
<!-- Relative to page location -->
80+
![Alt text](../../assets/images/logo.png "Optional title")
81+
82+
<!-- Relative to fern folder root -->
83+
![Overview](/assets/images/logo.png)
7684
```
7785
</Tab>
7886
<Tab title="HTML">
7987
```html
80-
<img src="../assets/images/overview.png" width="500px" height="auto" />
88+
<!-- Relative to page location -->
89+
<img src="../../assets/images/logo.png" width="500px" height="auto" />
90+
91+
<!-- Relative to fern folder root -->
92+
<img src="/assets/images/logo.png" width="500px" height="auto" />
8193
```
8294
</Tab>
8395
</Tabs>
@@ -96,16 +108,6 @@ Common image attributes:
96108
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).
97109
</Note>
98110

99-
### Image paths
100-
101-
When referencing images, you can use either relative paths (`./` or `../`) or paths relative to the root of the `fern` folder by using `/`. For example, if you have an image at `fern/assets/images/overview.png`, you can reference it from any page using `/assets/images/overview.png`:
102-
103-
```markdown
104-
![Overview](/assets/images/overview.png)
105-
```
106-
107-
This is equivalent to using a relative path like `../../assets/images/overview.png`, but is more concise and doesn't depend on the current page's location in the folder structure.
108-
109111
## Embedding local assets
110112

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

0 commit comments

Comments
 (0)