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

Broken link transformation #10072

Closed
7 tasks done
iAdramelk opened this issue Apr 24, 2024 · 2 comments
Closed
7 tasks done

Broken link transformation #10072

iAdramelk opened this issue Apr 24, 2024 · 2 comments
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

Comments

@iAdramelk
Copy link
Contributor

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

.mdx extension is not removed from the link if the link text is split into two lines.

Reproducible demo

https://codesandbox.io/p/devbox/determined-northcutt-fdkm45?file=%2Fdocs%2Findex.mdx%3A5%2C1

Steps to reproduce

Put this code in the mdx file in the /docs/ folder (assuming that installation.mdx file exists in the same folder):

[Some
link](./installation.mdx)

[Some link](./installation.mdx)

Expected behavior

I expect that both links will be transformed to <a href="/docs/installation">Some link</a>.

Actual behavior

In practice, only the second link is transformed correctly. The first link is left as <a href="/installation.mdx">Some link</a>.

See the attached codesandbox demo.

Your environment

Self-service

  • I'd be willing to fix this bug myself.
@iAdramelk iAdramelk 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 Apr 24, 2024
@iAdramelk
Copy link
Contributor Author

P. S. Can't find an extension replacing logic in https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-mdx-loader/src/remark/transformLinks/index.ts , would be grateful for a tip where to look for the related code.

@slorber
Copy link
Collaborator

slorber commented Apr 25, 2024

This is already tracked in #9048 and related to our linkify function

I understand you'd be willing to attempt to fix it, but this is not so easy to migrate from processing docs as strings to ASTs so I'd rather solve this myself.

@slorber slorber closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
@slorber slorber added closed: duplicate This issue or pull request already exists in another issue or pull request and removed status: needs triage This issue has not been triaged by maintainers labels Apr 25, 2024
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
Projects
None yet
Development

No branches or pull requests

2 participants