json-schema-org / json-schema-org/website

🐛 Bug: transformMarkdownLinks regex fails on implicit and collapsed reference links

Open
#2,265 3 comments 0 reactions 1 assignee View on GitHub

@h30s is already working on this.

Since Feb 22, 2026.

🐛 Bug Status: Stale Status: Triage
Dominant language
HTML
Stars
169
Forks
484
Avg merge
2d 2h
Merged PRs (30d)
6

Description

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
  1. Author or preview any markdown file in the website that uses StyledMarkdown.tsx.
  2. Add a standard empty bracket reference link: Here is a [link][] and define it below: [link]: https://example.com
  3. Add a collapsed reference link: Here is a [link] and define it below.
  4. Render the page.
  5. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.