Skip to content

Commit

Permalink
Updates how the new Image component is exported to support older vers…
Browse files Browse the repository at this point in the history
…ions of Astro (#3812)

* don't use typescript for the components named export file

* Adding a readme example for images in markdown

* chore: add changeset
  • Loading branch information
Tony Sullivan authored Jul 4, 2022
1 parent 08d0684 commit 5ccccac
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/pretty-rats-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@astrojs/image': patch
---

- Updates how the `<Image />` component is exported to support older versions of Astro
- Adds an example of using the `<Image />` component in markdown pages
24 changes: 24 additions & 0 deletions packages/integrations/image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,30 @@ const imageUrl = 'https://www.google.com/images/branding/googlelogo/2x/googlelog
```
</details>

<details>
<summary><strong>Images in markdown</strong></summary>

<br/>

The `<Image />` component can also be used to optimize images in markdown pages. For local images imported from your project's `src` directory, use Astro's the `setup` frontmatter to import the image file.

```html
---
setup: |
import { Image } from '@astrojs/image/components'
import hero from '../../assets/blog/introducing-astro.jpg'
title: Hello world!
publishDate: 12 Sep 2021
name: Nate Moore
value: 128
description: Just a Hello World Post!
---

<Image src={hero} width={640} />
<Image src="https://example.com/image.jpg" width={640} aspectRatio="16:9" />
```
</details>

## Troubleshooting
- If your installation doesn't seem to be working, make sure to restart the dev server.
- If you edit and save a file and don't see your site update accordingly, try refreshing the page.
Expand Down

0 comments on commit 5ccccac

Please sign in to comment.