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

Forbid links to localhost with Markdownlint #25542

Closed
3 tasks done
teoli2003 opened this issue Mar 22, 2023 · 3 comments · Fixed by #25761
Closed
3 tasks done

Forbid links to localhost with Markdownlint #25542

teoli2003 opened this issue Mar 22, 2023 · 3 comments · Fixed by #25761
Labels
Content:WebAPI Web API docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.

Comments

@teoli2003
Copy link
Contributor

Summary

This happens in #23675

A few links lead to https://localhost:5042/....

These are always erroneous. We should:

  • Raises a flaw
  • Magically convert them to /... (like we do for https://developer.mozilla.org/)

URL

None that I know.

Reproduction steps

  1. Create a Markdown link in a page like [HTMLElement](https://localhost:5042/en-US/docs/Web/API/HTMLElement)
  2. Build the page

Expected behavior

A flaw is reported.
The link is transformed into the equivalent of [HTMLElement](/en-US/docs/Web/API/HTMLElement)

Actual behavior

No flaw reported
A broken link.

Device

Desktop

Browser

Chrome

Browser version

Stable

Operating system

Android

Screenshot

No response

Anything else?

I think we can solve this issue by adding an extra alternative at: https://github.com/mdn/yari/blob/main/build/flaws/broken-links.ts#L232

Something similar to:

Capture d’écran 2023-03-22 à 10 37 54

But for https://localhost[:wxyz]?

If this is the right way, I can create a PR.

Validations

@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Mar 22, 2023
@caugner
Copy link
Contributor

caugner commented Mar 22, 2023

Can we add a markdownlint rule like the one for fully-qualified developer.mozilla.org URLs?

{
"name": "fqdn-moz-links",
"message": "Don't use developer.mozilla.org for links",
"search": "](https://developer.mozilla.org/",
"replace": "](/",
"skipCode": true
},

@caugner caugner added p3 and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Mar 22, 2023
@teoli2003
Copy link
Contributor Author

Oh yes! Good point. I will do it.

@caugner caugner transferred this issue from mdn/yari Mar 22, 2023
@caugner caugner changed the title Forbid links to localhost Forbid links to localhost with Markdownlint Mar 22, 2023
@github-actions github-actions bot added Content:WebAPI Web API docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Mar 22, 2023
@hamishwillee
Copy link
Collaborator

This is a good catch @teoli2003 !

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Content:WebAPI Web API docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants