Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 regression: broken link if the first url has a anchor and the second url is in parenthesis #9553

Closed
5 of 7 tasks
hasezoey opened this issue Nov 15, 2023 · 2 comments
Closed
5 of 7 tasks
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: duplicate This issue or pull request already exists in another issue or pull request domain: markdown Related to Markdown parsing or syntax

Comments

@hasezoey
Copy link

hasezoey commented Nov 15, 2023

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

with docusaurus 3.0.0 a url is broken if the first url has a anchor ([a](./file.md#anchor)) and the second url uses the same url, but is in parenthesis (([b](./file.md#anchor])), fuller example:

[a](./migration/migrate-6.md#hooks) ([b](./migration/migrate-6.md#hooks))

this does not occur if no parenthesis are used:

[a](./migration/migrate-6.md#hooks) [b](./migration/migrate-6.md#hooks)

or if the first url does not have a anchor:

[a](./migration/migrate-6.md) ([b](./migration/migrate-6.md#hooks))

PS: removing (or changing) the "id:" in the target file does not change the error

Reproducible demo

https://github.com/typegoose/typegoose/tree/docusuaursV3urlError

Steps to reproduce

  1. clone the repo (and checkout the the branch docusuaursV3urlError)
  2. cd into website/
  3. run yarn install
  4. run yarn run build
  5. observe 2 errors:
  • once for /typegoose/docs/guides/advanced/reference-other-classes - which is the original case where i first saw the error
  • once for /typegoose/docs/guides/error-warning-details - which is a reproduction of the issue

Expected behavior

the url to successfully compile with a correct link like in 2.4.3

Actual behavior

Broken link at runtime, and on build a broken link error:

Error: Unable to build website for locale en.
    at tryToBuildLocale (/mnt/projects/nodejs/typegoose/website/node_modules/@docusaurus/core/lib/commands/build.js:55:19)
    at mapAsyncSequential (/mnt/projects/nodejs/typegoose/website/node_modules/@docusaurus/utils/src/jsUtils.ts:45:20)
    at async Command.build (/mnt/projects/nodejs/typegoose/website/node_modules/@docusaurus/core/lib/commands/build.js:82:21) {
  [cause]: Error: Docusaurus found broken links!
  
  Please check the pages of your site in the list below, and make sure you don't reference any path that does not exist.
  Note: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass.
  
  Exhaustive list of all broken links found:
  
  - On source page path = /typegoose/docs/guides/advanced/reference-other-classes:
     -> linking to ../../api/functions/typeguards/isDocument.md#isdocumentarray (resolved as: /typegoose/docs/api/functions/typeguards/isDocument.md)
  
  - On source page path = /typegoose/docs/guides/error-warning-details:
     -> linking to ./migration/migrate-6.md#hooks (resolved as: /typegoose/docs/guides/migration/migrate-6.md)
  
      at throwError (/mnt/projects/nodejs/typegoose/website/node_modules/@docusaurus/logger/src/index.ts:135:9)
      at handleBrokenLinks (/mnt/projects/nodejs/typegoose/website/node_modules/@docusaurus/core/lib/server/brokenLinks.js:153:47)
      at async buildLocale (/mnt/projects/nodejs/typegoose/website/node_modules/@docusaurus/core/lib/commands/build.js:192:5)
      at async tryToBuildLocale (/mnt/projects/nodejs/typegoose/website/node_modules/@docusaurus/core/lib/commands/build.js:46:20)
      at mapAsyncSequential (/mnt/projects/nodejs/typegoose/website/node_modules/@docusaurus/utils/src/jsUtils.ts:45:20)
      at async Command.build (/mnt/projects/nodejs/typegoose/website/node_modules/@docusaurus/core/lib/commands/build.js:82:21)
}

[INFO] Docusaurus version: 3.0.0
Node version: v21.1.0

Your environment

Self-service

  • I'd be willing to fix this bug myself.
@hasezoey hasezoey added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 15, 2023
@Josh-Cena Josh-Cena added domain: markdown Related to Markdown parsing or syntax and removed status: needs triage This issue has not been triaged by maintainers labels Nov 15, 2023
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Nov 15, 2023

I think this is a duplicate of #9518. We'll make sure we fix both. Thanks for the detailed investigation!

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2023
@Josh-Cena Josh-Cena added closed: duplicate This issue or pull request already exists in another issue or pull request domain: markdown Related to Markdown parsing or syntax and removed domain: markdown Related to Markdown parsing or syntax labels Nov 15, 2023
@slorber
Copy link
Collaborator

slorber commented Apr 25, 2024

The issue to track for resolution of this bug is now #9048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: duplicate This issue or pull request already exists in another issue or pull request domain: markdown Related to Markdown parsing or syntax
Projects
None yet
Development

No branches or pull requests

3 participants