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

Fix all broken anchor links in JS docs #22140

Merged
merged 3 commits into from
Nov 8, 2022

Conversation

Josh-Cena
Copy link
Member

Description

I wrote a little script that analyzes all anchor links in the HTML output. Ended up finding a handful of nonexistent anchors.

Motivation

Additional details

Related issues and pull requests

@Josh-Cena Josh-Cena requested a review from a team as a code owner November 7, 2022 22:24
@Josh-Cena Josh-Cena requested review from teoli2003 and removed request for a team November 7, 2022 22:24
@github-actions github-actions bot added the Content:JS JavaScript docs label Nov 7, 2022
@Josh-Cena Josh-Cena force-pushed the fix-anchor-links branch 2 times, most recently from d643ad0 to 96728fa Compare November 7, 2022 22:26
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2022

Preview URLs (33 pages)

(this comment was updated 2022-11-08 00:33:29.903571)

@@ -187,7 +187,7 @@ const myCar = {
};
```

Like JavaScript variables, property names are case sensitive. Property names can only be strings or Symbols — all keys are [converted to strings](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion) unless they are Symbols. [Array indices](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#notes) are, in fact, properties with string keys that contain integers.
Like JavaScript variables, property names are case sensitive. Property names can only be strings or Symbols — all keys are [converted to strings](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion) unless they are Symbols. [Array indices](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#description) are, in fact, properties with string keys that contain integers.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the notes section actually mentions "Array indicies", while the now-linked description does not. I prefer a description link.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Notes" section is now gone—I'll add a new heading instead.

@@ -67,4 +66,4 @@ if (Object.hasOwn(foo, 'bar')) {

## See also

- {{jsxref("Operators/Property_Accessors", "property accessors", 0, 1)}}
- [Property accessors](/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW it's cases like this which make me much prefer normal links to macros.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly :) I think at some point we should deprecate the 3rd and 4th arguments. I only use the first two and sometimes I find it very useful.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I supect the macro will disappear altogether, and possibly we will see the "/en-US/docs/Web.." format replaced by the file structure URL. We will see.

@@ -575,7 +581,7 @@ This rule is a complement to the previous rule, specifically for the case where
- `(param) <here> => {}`
- `async <here> function`, `async <here> prop()`, `async <here> function*`, `async <here> *prop()`, `async <here> (param) <here> => {}`

Here `++` is not treated as a [postfix operator](/en-US/docs/Web/JavaScript/Reference/Operators#increment) applying to variable `b`, because a line terminator occurs between `b` and `++`.
Here [`++`](/en-US/docs/Web/JavaScript/Reference/Operators/Increment) is not treated as a postfix operator applying to variable `b`, because a line terminator occurs between `b` and `++`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, though this might clash with the change in the other PR we are discussing.

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Even scripted, a bit of work in there.

Probably worth us running the script over the rest of the docs (hint). Small chunks to review though - hard to maintain concentration.

@hamishwillee hamishwillee merged commit 5103969 into mdn:main Nov 8, 2022
@Josh-Cena
Copy link
Member Author

Yeah—I'm hesitant to run it over the entire corpus, partly because building all the HTML takes forever, partly because it often involves content refactoring and I'm not familiar with pages outside JS.

@Josh-Cena Josh-Cena deleted the fix-anchor-links branch November 8, 2022 00:45
@hamishwillee
Copy link
Collaborator

Yeah—I'm hesitant to run it over the entire corpus, partly because building all the HTML takes forever, partly because it often involves content refactoring and I'm not familiar with pages outside JS.

Fair enough. Don't know how versatile your tool is - but I was thinking small chunks and sharing the load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:JS JavaScript docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants