fix: GFM alerts not displaying properly when links are present #19424
+159
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #19409
This PR fixes an issue where GitHub Flavored Markdown (GFM) alerts containing links were not rendering correctly as alerts, instead falling back to regular blockquotes.
Changes
parseChildrenAsAlertContent
function to properly handle GFM alerts that contain linksTechnical Details
The issue occurred because when GFM alerts contained links, the parsing logic would get confused about the structure of the parsed content. The original code assumed the first element would always be a string containing the alert type (like
[!NOTE]
), but when links were present, the structure could be different.The fix:
Testing
Before/After
Before: GFM alerts with links would render as regular blockquotes
After: GFM alerts with links render correctly as styled alerts with proper coloring and formatting
The fix ensures that alerts like this now work correctly: