Repository navigation
Use AnchorJS to automatically generate heading anchors - #700
Merged
Merged
Conversation
Contributor
Author
|
Because this touches |
Contributor
Author
nchammas
marked this pull request as ready for review
October 14, 2026 11:07
HyukjinKwon
approved these changes
Oct 18, 2026
nchammas
added a commit
to apache/spark
that referenced
this pull request
Oct 26, 2026
### What changes were proposed in this pull request? Upgrade AnchorJS to v5.0.0, and update its config accordingly to maintain roughly the current production behavior. Additionally: - Move the AnchorJS config to `global.html`, which matches where we include and configure other vendored libraries. - Remove the `anchors` global from `main.js`, which is no longer needed now that the config is handled outside of there. - Fix the included licenses for AnchorJS so it includes the copyright holder's name and year. ### Why are the changes needed? The current version of AnchorJS we are using is [more than 11 years old][old]. The releases since then have added more accessible heading links and more reliable fragment generation. [old]: https://github.com/bryanbraun/anchorjs/releases/tag/1.1.1 This upgrade will also keep the versions in sync with the main website's version of AnchorJS: apache/spark-website#700 Any browser released since early 2021 should support this new version without issue. ### Does this PR introduce _any_ user-facing change? No, documentation behavior tweaks only. ### How was this patch tested? I built and reviewed the site locally with `SKIP_API=1 bundle exec jekyll serve`. Confirmed that anchors work as expected, including for `h1` headings. ### Was this patch authored or co-authored using generative AI tooling? Co-authored-by: GitHub Copilot Closes #59547 from nchammas/anchorjs-bump. Authored-by: Nicholas Chammas <nicholas.chammas@gmail.com> Signed-off-by: Nicholas Chammas <nicholas.chammas@gmail.com>
nchammas
added a commit
to apache/spark
that referenced
this pull request
Oct 26, 2026
### What changes were proposed in this pull request? Upgrade AnchorJS to v5.0.0, and update its config accordingly to maintain roughly the current production behavior. Additionally: - Move the AnchorJS config to `global.html`, which matches where we include and configure other vendored libraries. - Remove the `anchors` global from `main.js`, which is no longer needed now that the config is handled outside of there. - Fix the included licenses for AnchorJS so it includes the copyright holder's name and year. ### Why are the changes needed? The current version of AnchorJS we are using is [more than 11 years old][old]. The releases since then have added more accessible heading links and more reliable fragment generation. [old]: https://github.com/bryanbraun/anchorjs/releases/tag/1.1.1 This upgrade will also keep the versions in sync with the main website's version of AnchorJS: apache/spark-website#700 Any browser released since early 2021 should support this new version without issue. ### Does this PR introduce _any_ user-facing change? No, documentation behavior tweaks only. ### How was this patch tested? I built and reviewed the site locally with `SKIP_API=1 bundle exec jekyll serve`. Confirmed that anchors work as expected, including for `h1` headings. ### Was this patch authored or co-authored using generative AI tooling? Co-authored-by: GitHub Copilot Closes #59547 from nchammas/anchorjs-bump. Authored-by: Nicholas Chammas <nicholas.chammas@gmail.com> Signed-off-by: Nicholas Chammas <nicholas.chammas@gmail.com> (cherry picked from commit 5b71434) Signed-off-by: Nicholas Chammas <nicholas.chammas@gmail.com>
Contributor
Author
|
Confirmed post merge that the anchor links are working as expected: https://spark.apache.org/developer-tools.html#reducing-build-times (Note also the link that now appears when you hover over the heading!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now if you look at a page on the main website like Useful Developer Tools, you'll notice that you cannot easily click on a heading and get an HTML anchor that will let you link directly to that section. On the other hand, if you look at the programming docs, you'll see that you can get anchor links by mousing over a heading.
This discrepancy is because the programming docs include AnchorJS, whereas the main website does not.
This PR adds AnchorJS to the main docs so readers can easily link to headings there like they can on the programming docs:
This adds the latest release of AnchorJS, which is 5.0.0. The programming docs are on AnchorJS 1.1.1, which is more than 11 years old. In a matching PR, I will update the programming docs to also use AnchorJS 5.0.0 so they are consistent.
I built the docs locally and confirmed that the anchors work as expected.
Matching AnchorJS upgrade on the docs site: apache/spark#59547