Skip to content

Instantly share code, notes, and snippets.

@sarah11918
Created November 21, 2021 17:35
Show Gist options
  • Save sarah11918/15296cb3a51530e8d944e6abbdae50b2 to your computer and use it in GitHub Desktop.
Save sarah11918/15296cb3a51530e8d944e6abbdae50b2 to your computer and use it in GitHub Desktop.
Astro v0.21.0 - differences that aren't bugs/breaking changes

What's DIFFERENT (but not necessarily buggy/breaking) in Astro 0.21.0 ???

1. How to include a layout in .md files

Previously, front matter REQUIRED a layout property (e.g. layout: ../../layouts/MarkdownPostLayout.astro) Now, it's ALSO OK to include your layout as an import in "setup":

setup: |
  import Layout from '../../layouts/BlogPost.astro'
  import SomeOtherComponent from '../../components/SomeOtherComponent.astro'
@delucis
Copy link

delucis commented Nov 21, 2021

2. Expressions in props no longer work if surrounded by ""

Previously the following would work in an Astro component (perhaps unintentionally?). The value expression would be populated as expected.

<OtherAstroComponent prop="{value}">

Now, the surrounding quotes need to be removed:

<OtherAstroComponent prop={value}>

@delucis
Copy link

delucis commented Nov 21, 2021

3. Inline components inside <Markdown> break some rendering

Previously the following:

<Markdown>
Text: <Component />

Text: <Component />
</Markdown>

Would include the full line in paragraph tags:

<p>Text: <component elements /></p>
<p>Text: <component elements /></p>

Now it fails to generate the <p> tags:

Text: <component elements />
Text: <component elements />

Which causes everything to be on a single line (assuming the component isn’t a block element). One needs to explicitly include the <p> tags. This seems like slightly undesirable behaviour, but I don’t know how easy it is to address if this is handled by a third-party Markdown parser.

@sarah11918
Copy link
Author

4. In .md files, descriptions in square brackets can no longer include double quotation marks. (Single are fine)

X Breaking: ![My first "real" app](/images/image.jpg)

✓ Working: ![My first 'real' app](/images/image.jpg)

@sarah11918
Copy link
Author

5. Importing to use the <Markdown> component in .astro files now requires curly braces, whereas older versions were lenient

X Breaking:

---
 import Markdown from 'astro/components';
---

✓ Working:

---
 import { Markdown } from 'astro/components';
---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment