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
Docs: fix multiple broken links #14743
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
GitHub expects Should we rather change how the ids are generated on the website? While links on the website don't necessarily have to match how GitHub works, it would be easier for development and testing. |
The code was introduced 11 months ago in eslint/archive-website#755. I'm afraid there might be many links with single For instance, here's one I just found https://stackoverflow.com/a/65050590/1077489. You can see a link of But I agree it's better to align the website with files on Github. So maybe setting up some redirections on the website if we decide to update the rule? E.g., redirect |
I personally think that's okay. It's probably only one page and the links will still open the right page, just without scrolling to the section.
I don't think it's possible to do such server redirections as |
Cool, then I'm going to close this. |
However changing how the ids are generated on the website might cause other problems: md = md.use(require("markdown-it-anchor"), {
slugify(text) {
// need to replace all the characters GitHub replaces
return slug(text.replace(/[<>()[\]{}]/gu, ""))
// non-ASCII characters are a pain to fix
// first replace them all with dashes
.replace(/[^\u{00}-\u{FF}]/gu, "-")
// then replace all -- with -
.replace(/-+/gu, "-");
},
uniqueSlugStartIndex: 1
}); Because the markdown plugin is replacing non-ASCII characters with dashes first. Take https://eslint.org/docs/user-guide/configuring/ignoring-code#the-eslintignore-file for example, the current id is |
I'm not sure why are we doing that in two steps, I think that - .replace(/[^\u{00}-\u{FF}]/gu, "-")
- .replace(/-+/gu, "-");
+ .replace(/[^\u{00}-\u{FF}]/gu, "");
I didn't understand this example. The input |
Oops, you're right, that example is a bad one, I should run it with code first :) I agree with your suggestion here. It's a nice method to evaluate the potential consequence of that change. |
@mdjermanovic I've applied your suggestion locally and run the E.g., Generally I think it's ok to make those changes. But you might want to assess it yourself. Btw, once applied, URI fragments like |
123 sounds good, By your list, it looks like half of the changes will be in Changes like https://github.com/eslint/eslint/blob/master/docs/rules/lines-around-directive.md#before--after I think we should do this. (I couldn't figure out - what will be changed in |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[x] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Fix multiple broken links.
The markdown plugin defined here https://github.com/eslint/website/blob/master/_11ty/plugins/markdown-plugins.js#L40 would replace
--
with-
, take https://eslint.org/docs/user-guide/command-line-interface#-resolve-plugins-relative-to for example:Namely, header anchors will contain only one
-
instead of two. Hence it's wrong to use--
when linking to those header anchors.Is there anything you'd like reviewers to focus on?
Nothing.