Repository navigation
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
Error message got
Exhaustive list of all broken links found:
- Broken link on source page path = /api/interfaces/EndpointSettings:
-> linking to EndpointIPAMConfig.md (resolved as: /api/interfaces/EndpointIPAMConfig.md)
Let's break it down. On page /api/interfaces/EndpointSettings specifically, let's find the link to the EndpointIPAMConfig.md file.
- Here is the broken link :
[EndpointIPAMConfig](EndpointIPAMConfig.md)
It is using relative link, and have the
.mdsuffix. (just like many other links in the same folder)
- EndpointIPAMConfig.md and EndpointIPAMConfig.md are in the same folders.
Debugging the issue.
Let's run the debugger for the building process. I added some breakpoints in the handleBrokenLinks.
Inside the isPathBrokenLink we got the following, when we reached linkPath === { "pathname": "/api/interfaces/EndpointIPAMConfig.md" }
Let's evaluate the validPathnames (used for optimizations)
with .md |
without |
|---|---|
![]() |
![]() |
Since the file with the .md suffix is not included in the validPathnames, we result in calling the react-router-config method matchRoutes.
However it has not any chance of success since this are the provided arguments
Resulting in the link being added to the brokens list
Reproducible demo
No response
Steps to reproduce
(1) git clone https://github.com/axel7083/docusaurus-reproductible-broken-link
(2) npm install
(3) npm run build
Wait and see
Expected behavior
Not detecting a broken links as it is not one
Actual behavior
Broken link detected
Your environment
- Public source code: https://github.com/axel7083/podman-desktop/tree/24f217519eb2e19f143b34007de3b7def390b266
- Public site URL: https://podman-desktop.io/
- Docusaurus version used: 3.1.1
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome latest
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows 11
Self-service
- I'd be willing to fix this bug myself.


Activity
[-]Broken link found where it should not[/-][+]Broken link found where it should not on relative (same folder) link[/+]axel7083 commentedon Feb 21, 2024
I added a minimal reproductible example here https://github.com/axel7083/docusaurus-reproductible-broken-link
axel7083 commentedon Feb 21, 2024
cc @slorber
slorber commentedon Feb 22, 2024
The problem is not in the broken link checker. Markdown relative file links should be resolved before reaching the broken link checker, and not end with
.md.The problem is in our legacy
replaceMarkdownLinksfunction and how it handles fenced code blocks with hacky regexes.A minimal repro:
It's not clear to me why you use "inline triple backticks" instead of regular inline code blocks, but you can probably fix the problem by migrating to regular inline code blocks.
The solution should be #9048, so I'm closing this issue as a duplicate.
axel7083 commentedon Feb 22, 2024
The markdown is generated by https://github.com/tgreyuk/typedoc-plugin-markdown
slorber commentedon Feb 22, 2024
I see thanks, will track the issue to see what the author has to say.
melroy89 commentedon Apr 28, 2024
This is a very nasty bug and hard to debug! Please support triple backticks!