-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Detect broken anchor links #3321
Comments
That would be amazing! We were thinking about adding this to our documentation setup (I was initially looking into something like |
If anyone else is desperately waiting on this feature, I was able to get broken link detection set up in CI for my Docusaurus website using
|
Thanks @Zamiell that's useful to know how you made this work :) We'll probably build something more "integrated" on top of the existing broken links checker (which only runs at built time), but having a remark linter could also be helpful to "pre-check" the links. |
+1 for this feature, Also slightly related (I can create a new ticket if you think it's adequate) If your file is called docs I've tried to implement some workaround modifying this function and should not be very complicated. I think it would be great if docusaurus warned about this situation! Thx for the nice work you do 🙏 |
I would also like this feature. In the meantime, IntelliJ tells me if an open markdown file has Unresolved file references. Maybe there is a way for me to add that to my CI. |
For anyone who interested, I've created a plugin for remark-validate-links to support custom heading ID. Please refer to https://github.com/xiaogaozi/remark-validate-links-heading-id for more information. |
Thanks for reporting @xiaogaozi Note as part fo the MDX 2 migration (#8288), It should also be possible to escape ids: Make sure to adapt once we upgrade to MDX 2 |
@slorber Actually I use |
Thanks to all the folks who contributed to this issue, I managed to implement the broken anchor links detection for both Packagesnpm install --save-dev concurrently
npm install --save-dev remark-cli
npm install --save-dev remark-validate-links
|
As a user, I've looked at "how can I make sure the links in the docs are OK?" problem today, some findings:
|
🚀 Feature
We can detect broken links now, but another thing that can break easily is anchor links. As we currently auto-generate ids based on heading text, rewriting a heading can break linking, and it's not easy to notice it.
We need a way to check anchor links at build time too, fail fast, and report errors
The text was updated successfully, but these errors were encountered: