Repository navigation
Closed as not planned
Labels
bugAn error in the Docusaurus core causing instability or issues with its executionclosed: duplicateThis issue or pull request already exists in another issue or pull request
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand 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
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
- Public source code and demo: https://codesandbox.io/p/devbox/determined-northcutt-fdkm45?file=%2Fdocs%2Findex.mdx%3A1%2C1-4%2C32
- Docusaurus version used: 3.2.1 (3.2.0 in the demo)
Self-service
- I'd be willing to fix this bug myself.
Metadata
Metadata
Assignees
Labels
bugAn error in the Docusaurus core causing instability or issues with its executionclosed: duplicateThis issue or pull request already exists in another issue or pull request
Activity
iAdramelk commentedon Apr 24, 2024
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 commentedon 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.