You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/en/guides/upgrade-to/v6.mdx
+25-18Lines changed: 25 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -590,17 +590,35 @@ If you need more control over environment variables in Astro, we recommend you u
590
590
591
591
<SourcePRnumber="14494"title="feat!: stabilize experimental.headingIdCompat"/>
592
592
593
-
In Astro 5.5, the `experimental.headingIdCompat` flag was introduced to make the IDs generated by Astro for Markdown headings compatible with common platforms like GitHub and npm, using the popular [`github-slugger`](https://github.com/Flet/github-slugger) package.
593
+
In Astro 5.x, an additional default processing step to Markdown stripped trailing hyphens from the end of IDs for section headings ending in special characters. This provided a cleaner `id` value, but could lead to incompatibilities rendering your Markdown across platforms.
594
594
595
-
In Astro 5.x, Astro had an additional default processing step that stripped trailing hyphens from the end of IDs for headings ending in special characters.
595
+
In Astro 5.5, the `experimental.headingIdCompat` flag was introduced to allow you to make the IDs generated by Astro for Markdown headings compatible with common platforms like GitHub and npm, using the popular [`github-slugger`](https://github.com/Flet/github-slugger) package.
596
596
597
-
Astro 6.0 removes this experimental flag and makes this the new default behavior in Astro: trailing hyphens from the end of IDs for headings ending in special characters aren't stripped anymore.
597
+
Astro 6.0 removes this experimental flag and makes this the new default behavior in Astro: trailing hyphens from the end of IDs for headings ending in special characters are no longer removed.
598
598
599
599
#### What should I do?
600
600
601
-
If you were previously using this experimental feature, you must [remove this experimental flag from your configuration](#experimental-flags) as it no longer exists.
601
+
If you have manual links to headings, you may need to update the anchor link value with a new trailing hyphen. For example, the following Markdown heading:
602
+
603
+
```md
604
+
## `<Picture />`
605
+
```
606
+
607
+
will now generate the following HTML with a trailing hyphen in the heading `id`:
602
608
603
-
If you were previously using the `rehypeHeadingIds` plugin directly, remove the `headingIdCompat` option as it no longer exists:
609
+
```html ins="-"
610
+
<h2id="picture-"><code><Picture /></h2>
611
+
```
612
+
613
+
and must now be linked to as:
614
+
615
+
```markdown ins="-"
616
+
See [the Picture component](/en/guides/images/#picture-) for more details.
617
+
```
618
+
619
+
If you were previously using the experimental feature to enforce trailing hyphens, you must [remove this experimental flag from your configuration](#experimental-flags) as it no longer exists.
620
+
621
+
If you were previously using the `rehypeHeadingIds` plugin directly to enforce compatibility, remove the `headingIdCompat` option as it no longer exists:
If you have manual links to headings, review them to make sure they're still correct. For example, the following Markdown heading:
622
-
623
-
```md
624
-
## `<Picture />`
625
-
```
626
-
627
-
will generate the following HTML:
628
-
629
-
```html del={1} ins={2}
630
-
<h2id="picture"><code><Picture /></h2>
631
-
<h2id="picture-"><code><Picture /></h2>
632
-
```
639
+
If you want to keep the old ID generation for backward compatibility reasons, you can create a custom rehype plugin that will generate headings IDs like Astro 5.x. This will allow you to continue to use your existing anchor links without adding trailing hyphens.
633
640
634
641
<details>
635
642
636
-
<summary>If you want to keep the old ID generation for backward compatibility reasons, you can create a custom rehype plugin that will generate headings IDs like Astro 5.x. Click to expand.</summary>
643
+
<summary>Create a custom rehype plugin to strip trailing hyphens</summary>
0 commit comments