Skip to content

Conversation

bsmth
Copy link
Member

@bsmth bsmth commented Jun 13, 2023

We have checks for markdown links that start with /en :

"name": "relative-link",
"message": "Internal links should start with '/'",
"search": "(en-US/docs",
"replace": "(/en-US/docs",
"skipCode": true

This doesn't catch HTML tables. This PR does a search and replace for stray internal refs that start with en-US instead of /en-US.

@bsmth bsmth requested a review from caugner June 13, 2023 10:21
@bsmth bsmth requested review from a team as code owners June 13, 2023 10:21
@bsmth bsmth requested review from fred-wang and dipikabh and removed request for a team June 13, 2023 10:21
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs Content:Learn Learning area docs Content:MathML MathML docs labels Jun 13, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 13, 2023

Preview URLs

Flaws (4)

Note! 3 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/MathML/Attribute
Title: Attributes
Flaw count: 1

  • broken_links:
    • Can't resolve /en-US/docs/Web/MathML/Attribute/Values

URL: /en-US/docs/Web/HTML/Element/input/password
Title: <input type="password">
Flaw count: 3

  • macros:
    • /en-US/docs/Web/API/HTMLInputElement/selectionStart does not exist
    • /en-US/docs/Web/API/HTMLInputElement/selectionEnd does not exist
    • /en-US/docs/Web/API/HTMLInputElement/selectionDirection does not exist

(comment last updated: 2023-06-14 14:38:47)

@Josh-Cena
Copy link
Member

I suggest changing the config to:

 "search": "(?<=[(\"])en-US/docs",
 "replace": "/en-US/docs",

@Josh-Cena Josh-Cena changed the title chore: add leading slash to internal xrefs in HTML tables chore: add leading slash to internal hrefs in HTML tables Jun 13, 2023
@bsmth
Copy link
Member Author

bsmth commented Jun 13, 2023

I suggest changing the config to (?<=[(\"])en-US/docs

Good idea, I can try roll that into this PR

@Josh-Cena Josh-Cena linked an issue Jun 14, 2023 that may be closed by this pull request
@bsmth bsmth requested a review from a team as a code owner June 14, 2023 09:15
@github-actions github-actions bot added the merge conflicts 🚧 [PR only] label Jun 14, 2023
@github-actions
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions github-actions bot removed the merge conflicts 🚧 [PR only] label Jun 14, 2023
@bsmth
Copy link
Member Author

bsmth commented Jun 14, 2023

I suggest changing the config to:

 "search": "(?<=[(\"])en-US/docs",
 "replace": "/en-US/docs",

The CLI tool was erroring out with lookbehind assertion, maybe I'm missing something in how to write the rules in this config. Anyway I added an alternative in 4b3d3b9 that performs the replacement as expected.

@bsmth
Copy link
Member Author

bsmth commented Jun 15, 2023

Thanks @caugner, merging 👍🏻

@bsmth bsmth merged commit 35f5664 into mdn:main Jun 15, 2023
@bsmth bsmth deleted the 404-fixes branch June 15, 2023 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTML Hypertext Markup Language docs Content:Learn Learning area docs Content:MathML MathML docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken link
3 participants