Describe the bug
The custom markdown pre-processor transformMarkdownLinks in lib/markdownUtils.ts (used by StyledMarkdown.tsx) uses a regular expression that breaks standard Markdown reference links. Specifically, it fails to parse implicit reference links (like [text][]) and completely ignores collapsed reference links ([text]).
This negatively impacts the authoring experience because contributors writing documentation have to redundantly type out their reference links (e.g., [JSON Schema][JSON Schema]) just to appease the custom parser, deviating from standard Markdown spec behavior.
Steps To Reproduce
- Author or preview any markdown file in the website that uses StyledMarkdown.tsx.
- Add a standard empty bracket reference link:
Here is a [link][] and define it below: [link]: https://example.com
- Add a collapsed reference link:
Here is a [link] and define it below.
- Render the page.
- See error: The links are not converted to anchor tags; they render as raw text.
Expected Behavior
Both [link][] and [link] should be correctly parsed and converted into standard inline markdown links [link](https://example.com). The regex should fallback to matching the primary text if the secondary ID block is empty or missing.
Screenshots
No response
Device Information [optional]
- OS:
- Browser:
- version:
Are you working on this issue?
Yes
Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)
No
Describe the bug
The custom markdown pre-processor transformMarkdownLinks in lib/markdownUtils.ts (used by StyledMarkdown.tsx) uses a regular expression that breaks standard Markdown reference links. Specifically, it fails to parse implicit reference links (like
[text][]) and completely ignores collapsed reference links ([text]).This negatively impacts the authoring experience because contributors writing documentation have to redundantly type out their reference links (e.g.,
[JSON Schema][JSON Schema]) just to appease the custom parser, deviating from standard Markdown spec behavior.Steps To Reproduce
Here is a [link][]and define it below:[link]: https://example.comHere is a [link]and define it below.Expected Behavior
Both
[link][]and[link]should be correctly parsed and converted into standard inline markdown links[link](https://example.com). The regex should fallback to matching the primary text if the secondary ID block is empty or missing.Screenshots
No response
Device Information [optional]
Are you working on this issue?
Yes
Do you think this work might require an [Architectural Decision Record (ADR)]? (significant or noteworthy)
No