-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix MDX heading IDs generation when using a frontmatter reference (#5978
) * Fix MDX heading IDs generation when using a frontmatter reference * Hoist safelyGetAstroData() call and add statement null check
- Loading branch information
Showing
6 changed files
with
172 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@astrojs/mdx': patch | ||
'@astrojs/markdown-remark': patch | ||
--- | ||
|
||
Fix MDX heading IDs generation when using a frontmatter reference |
45 changes: 45 additions & 0 deletions
45
...grations/mdx/test/fixtures/mdx-get-headings/src/pages/test-with-frontmatter.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: The Frontmatter Title | ||
keywords: [Keyword 1, Keyword 2, Keyword 3] | ||
tags: | ||
- Tag 1 | ||
- Tag 2 | ||
- Tag 3 | ||
items: | ||
- value: Item 1 | ||
- value: Item 2 | ||
- value: Item 3 | ||
nested_items: | ||
nested: | ||
- value: Nested Item 1 | ||
- value: Nested Item 2 | ||
- value: Nested Item 3 | ||
--- | ||
|
||
# {frontmatter.title} | ||
|
||
This ID should be the frontmatter title. | ||
|
||
## frontmatter.title | ||
|
||
The ID should not be the frontmatter title. | ||
|
||
### {frontmatter.keywords[1]} | ||
|
||
The ID should be the frontmatter keyword #2. | ||
|
||
### {frontmatter.tags[0]} | ||
|
||
The ID should be the frontmatter tag #1. | ||
|
||
#### {frontmatter.items[1].value} | ||
|
||
The ID should be the frontmatter item #2. | ||
|
||
##### {frontmatter.nested_items.nested[2].value} | ||
|
||
The ID should be the frontmatter nested item #3. | ||
|
||
###### {frontmatter.unknown} | ||
|
||
This ID should not reference the frontmatter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.