remarkjs / remark-lint-no-dead-urls

lint rule to warn when URLs are dead
https://unifiedjs.com
MIT License
77 stars 13 forks source link

Backtick after URL in error message linkified on GitHub Actions workflow logs #51

Closed karlhorky closed 1 week ago

karlhorky commented 1 week ago

Initial checklist

Affected packages and versions

remark-lint-no-dead-urls@2.0.0

Link to runnable example

No response

Steps to reproduce

  1. Run remark-lint-no-dead-urls on GitHub Actions and click on a failing link in the output
  2. 💥 The link includes the backtick, encoded as %60, likely leading to confusion

You can see it here, the backtick is also underlined and has a gray color:

Screenshot 2024-09-27 at 19 13 57

Screenshot 2024-09-27 at 19 13 50

As text:

17:124-17:180    warning Unexpected dead URL `https://trekhleb.dev/js-image-carver/`, expected live URL                                                                                                                                                                                                                        no-dead-urls remark-lint
  [cause]:
                 error   Unexpected error fetching `https://trekhleb.dev/js-image-carver/`                                                                                                                                                                                                                                     fetch        dead-or-alive
  [cause]:
    TimeoutError: The operation was aborted due to timeout

Expected behavior

Links do not include extra suffix or prefix characters which will be linkified by GitHub

Actual behavior

Links include the extra suffix backtick character which will be linkified by GitHub

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

ChristianMurphy commented 1 week ago

Thanks for sharing @karlhorky! Similar to https://github.com/remarkjs/remark-lint-no-dead-urls/issues/50 this feels more like a reporter than something that needs-to-be/should be fixed here.

wooorm commented 1 week ago

It is intentional that markdown syntax is used in message reasons.

If GitHub Actions has a “linkifier” that doesn’t work, report it with them.

karlhorky commented 1 week ago

If GitHub Actions has a “linkifier” that doesn’t work, report it with them.

I would, but the likelihood of GitHub fixing bugs is... unlikely. There are many open bugs since years that are very publicly reported. After many 10s or 100s of hours of reporting bugs without any feedback, it's becoming clear that it's not worth reporting bugs to GitHub.

In my opinion, projects should instead work around the bugs in GitHub. But I don't think this opinion is shared by the MDX team.

I guess I'll have to come up with a way to fix the output of remark-lint-no-dead-urls using sed or something (or maybe it could be a Refined GitHub feature). The suggestion to build a custom reporter sounds like a lot of work + research + investment.

markdown syntax is used in message reasons

I can understand that. However, I guess I would argue that using a inline code block with backticks around a URL is unnecessary and error-prone. I usually try to avoid having any characters close to URLs that I write in any format, because of linkification problems like this, across lots of software, not only GitHub.

wooorm commented 1 week ago

In my opinion, projects should instead work around the bugs in GitHub. But I don't think this opinion is shared by the MDX team.

You can make a GH reporter.

However, I guess I would argue that using a inline code block with backticks around a URL is unnecessary and error-prone

I disagree. URLs are not grammatical values. They are code.

karlhorky commented 1 week ago

What about a middle path - adding a space inside the backticks on both ends? Then the URL still stays as code, but the backtick character isn't directly next to the URL.

remcohaszing commented 1 week ago

I don’t really mind whether or not the URL is surrounded by backticks, but I agree with Titus that this is a problem with GitHub’s link detection.

wooorm commented 1 week ago

I do not think that is a middle path; I think that is ugly for everybody else. If GH doesn’t work well for you, make a reporter to make it work well, or use a different tool that works well, such as your local editor.

karlhorky commented 1 week ago

Ok, I understand this will not be accepted, but one last thing:

If GH doesn't work well for you

This is actually not as much about me (I'll probably remember, for a few weeks / months at least). And I'll probably build some workaround, so that I and others on our team don't need to remember.

But it's more about confusing all users who click on remark-lint-no-dead-urls links in a very common tool / environment. (who would not have the workaround installed, so thus have broken links by default)

ChristianMurphy commented 1 week ago

But it's more about confusing all users who click on remark-lint-no-dead-urls links in a very common tool / environment. (who would not have the workaround installed, so thus have broken links by default)

I hear you, understand you, and appreciate your viewpoint. There can be (and are) bugs in common and popular tools that should be fixed right there at the origin. Many are quickly fixed. 🎉

If any get stuck (case and point https://github.com/jestjs/jest/issues/9430 still blocks usage of ESM) the recommendation for users who are frustrated is to move to another tool entirely.


Mandatory XKCD reference 😉