Skip to content

Broken link found where it should not on relative (same folder) link #9876

Closed as not planned

Description

@axel7083

Have you read the Contributing Guidelines on issues?

Prerequisites

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 .md suffix. (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" }

image

Let's evaluate the validPathnames (used for optimizations)

with .md without
image image

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

image

Resulting in the link being added to the brokens list

image

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

Self-service

  • I'd be willing to fix this bug myself.

Activity

  1. added
    bug
    status: needs triage
    on Feb 21, 2024
  2. changed the title [-]Broken link found where it should not[/-] [+]Broken link found where it should not on relative (same folder) link[/+] on Feb 21, 2024
  3. axel7083 commented on Feb 21, 2024

    @axel7083
    ContributorAuthor
  4. axel7083 commented on Feb 21, 2024

    @axel7083
    ContributorAuthor
  5. slorber commented on Feb 22, 2024

    @slorber
    Collaborator

    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 replaceMarkdownLinks function and how it handles fenced code blocks with hacky regexes.

    A minimal repro:

    ```something```
    
    [test](test.md)

    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.

  6. added
    closed: duplicate
    and removed
    status: needs triage
    on Feb 22, 2024
  7. axel7083 commented on Feb 22, 2024

    @axel7083
    ContributorAuthor

    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 replaceMarkdownLinks function and how it handles fenced code blocks with hacky regexes.

    A minimal repro:

    ```something```
    
    [test](test.md)
    

    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.

    The markdown is generated by https://github.com/tgreyuk/typedoc-plugin-markdown

  8. slorber commented on Feb 22, 2024

    @slorber
    Collaborator

    I see thanks, will track the issue to see what the author has to say.

  9. melroy89 commented on Apr 28, 2024

    @melroy89

    This is a very nasty bug and hard to debug! Please support triple backticks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugclosed: duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions