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

Markdown link text split across newline breaks filepath-to-urlpath conversion #9636

Closed
6 of 7 tasks
grschafer opened this issue Dec 15, 2023 · 1 comment
Closed
6 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

Comments

@grschafer
Copy link

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

If a markdown link spans more than one line, the filepath-to-urlpath conversion mentioned here (https://docusaurus.io/docs/markdown-features/links) does not work.

There's a CodeSandbox repro below, which effectively shows:

<!-- This works, turning the link into "other-page" -->
A [link to another page](other-page.md)

<!-- This doesn't work, the link stays "other-page.md" -->
A [link to
another page](other-page.md)

Splitting link text across lines is valid markdown. It doesn't seem like formatting with prettier breaks link text across multiple lines (i.e. to obey a line width limit), but other tools do, which can lead to this issue unexpectedly breaking the link without any sort of error or warning.

Reproducible demo

https://codesandbox.io/p/devbox/stupefied-mclaren-55crfh

Steps to reproduce

  1. Visit the CodeSandbox link above
  2. Click on the "Demo" link in the top navbar of the browser pane
  3. Both "First link" and "Second link" link to other-page.md, but only the first is converted to point to /docs/other-page

Expected behavior

The markdown loader should convert relative links to files into url paths, regardless of the formatting of the link text.

Actual behavior

Relative links to files are not converted into url paths if the link text spans multiple lines.

Your environment

Self-service

  • I'd be willing to fix this bug myself.
@grschafer grschafer 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 Dec 15, 2023
@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 Dec 16, 2023
@slorber
Copy link
Collaborator

slorber commented Dec 16, 2023

Duplicate of #9523

Will be handled as part of #9048

@slorber slorber closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2023
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