question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onBrokenMarkdownLinks errors for invalid links inside tilde codeblocks only

See original GitHub issue

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

Docusaurus checks for broken links inside tilde code blocks when onBrokenMarkdownLinks is set to throw

Reproducible demo

No response

Steps to reproduce

  1. create a new docusaurus site using create-docusaurus
  2. make sure that docusaurus.config.js contains
    onBrokenLinks: 'throw',
    onBrokenMarkdownLinks: 'throw',
    
  3. Add following content to docs/intro.md
    ```
    this is an [invalid link](./path/to/a/page/that/does/not/exist.md)
    ```
    
  4. run npx docusaurus build to see the site build as expected
  5. change the codeblock from step 3 to use ~ instead of ` ie
    ~~~
    this is an [invalid link](./path/to/a/page/that/does/not/exist.md)
    ~~~
    
  6. run npx docusaurus build to see the build fail with an error
    Error: Docs markdown link couldn't be resolved: (./path/to/a/page/that/does/not/exist.md) in 
    "/Users/foo/bar/baz/docusaurus/packages/testsite/docs/intro.md" for version current
        at Array.forEach (<anonymous>)
    

Expected behavior

Docusaurus either does not check links inside codeblock or checks them for both backtick and tilde codeblocks when onBrokenMarkdownLinks is set to throw

Actual behavior

Docusaurus errors for broken markdown links only inside tilde codeblocks when onBrokenMarkdownLinks is set to throw

Your environment

  • Public source code: NA
  • Public site URL: NA
  • Docusaurus version used: Can reproduce with 2.0.0-beta.21 and 2.0.0-rc.1
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Node.js 16.4
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Macos

Self-service

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Josh-Cenacommented, Jul 19, 2022

In that case I would personally use four backticks…

1reaction
Josh-Cenacommented, Jul 18, 2022

@antonk52 Thanks for reporting! #7801 should fix this. You can watch out for the next canary (should be in a few minutes) and give it a try.

Read more comments on GitHub >

github_iconTop Results From Across the Web

onBrokenMarkdownLinks errors for invalid links inside tilde ...
[ ] I have read the console error message carefully (if applicable). Description. Docusaurus checks for broken links inside tilde code blocks when ......
Read more >
onBrokenMarkdownImagePaths to catch bad paths without ...
When I first saw the error, I immediately set onBrokenMarkdownLinks to "warn" thinking that it would allow the build to continue (I could...
Read more >
I keep on getting this error
I've just started with C++ and Code::Blocks and I've done what every noob does, the "Hello World! ... mingw32-make.exe: invalid option -- g...
Read more >
Fenced Code Blocks — Python-Markdown 3.4.1 documentation
To include a set of backticks (or tildes) within a code block, use a different number ... Fenced Code Blocks are only supported...
Read more >
Implement ```-style (fenced) Markdown code blocks
Code fences work now. · A code fence consists of three or more backticks ``` or tildes ~~~ , indented by zero to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found