This is an automated email from the ASF dual-hosted git repository.

nchammas pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new ec81341ad7b8 [SPARK-60281][DOC] Upgrade AnchorJS to v5.0.0
ec81341ad7b8 is described below

commit ec81341ad7b87a9b1ac2702b76070e9257b829b0
Author: Nicholas Chammas <[email protected]>
AuthorDate: Mon Oct 26 17:18:20 2026 +0200

    [SPARK-60281][DOC] Upgrade AnchorJS to v5.0.0
    
    ### 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: https://github.com/apache/spark-website/pull/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 <[email protected]>
    Signed-off-by: Nicholas Chammas <[email protected]>
    (cherry picked from commit 5b714349fb89a307c247ad7160cae546da909e7e)
    Signed-off-by: Nicholas Chammas <[email protected]>
---
 docs/_layouts/global.html            | 11 +++++++++++
 docs/js/main.js                      |  8 +-------
 docs/js/vendor/anchor.min.js         | 15 +++++++++------
 licenses-binary/LICENSE-AnchorJS.txt |  2 +-
 licenses/LICENSE-AnchorJS.txt        |  2 +-
 5 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/docs/_layouts/global.html b/docs/_layouts/global.html
index ef71211e6c8d..ed156b7afd17 100755
--- a/docs/_layouts/global.html
+++ b/docs/_layouts/global.html
@@ -196,7 +196,18 @@
         <script src="{{ rel_path_to_root }}js/vendor/jquery.min.js"></script>
         <script src="{{ rel_path_to_root 
}}js/vendor/bootstrap.bundle.min.js"></script>
 
+        {% comment %}
+        Keep the version of AnchorJS used here in sync with what's used on the 
main website.
+        See: 
https://github.com/apache/spark-website/blob/asf-site/js/vendor/anchor.min.js
+        {% endcomment %}
         <script src="{{ rel_path_to_root }}js/vendor/anchor.min.js"></script>
+        <script>
+            // Display anchor links when hovering over headings.
+            // See: https://www.bryanbraun.com/anchorjs/
+            // Note: AnchorJS 4.0+ excludes h1 from the default selector, but 
many
+            // Spark doc pages use h1 for section headings, so we include it 
explicitly.
+            anchors.add('#content :is(h1, h2, h3, h4, h5, h6)');
+        </script>
         <script src="{{ rel_path_to_root}}js/main.js"></script>
 
         <script type="text/javascript" src="{{ rel_path_to_root 
}}js/vendor/docsearch.min.js"></script>
diff --git a/docs/js/main.js b/docs/js/main.js
index 220cf4026bdc..c6e15b469e61 100755
--- a/docs/js/main.js
+++ b/docs/js/main.js
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* global $, anchors */
+/* global $ */
 
 /* Custom JavaScript code in the MarkDown docs */
 
@@ -89,12 +89,6 @@ function codeTabs() {
 
 $(function() {
   codeTabs();
-  // Display anchor links when hovering over headers. For documentation of the
-  // configuration options, see the AnchorJS documentation.
-  anchors.options = {
-    placement: 'right'
-  };
-  anchors.add();
 
   // Make dropdown menus in nav bars show on hover instead of click
   // using solution at https://webdesign.tutsplus.com/tutorials/how-
diff --git a/docs/js/vendor/anchor.min.js b/docs/js/vendor/anchor.min.js
index 68c3cb7073b6..00f80c058f6d 100755
--- a/docs/js/vendor/anchor.min.js
+++ b/docs/js/vendor/anchor.min.js
@@ -1,6 +1,9 @@
-/*!
- * AnchorJS - v1.1.1 - 2015-05-23
- * https://github.com/bryanbraun/anchorjs
- * Copyright (c) 2015 Bryan Braun; Licensed MIT
- */
-function AnchorJS(A){"use 
strict";this.options=A||{},this._applyRemainingDefaultOptions=function(A){this.options.icon=this.options.hasOwnProperty("icon")?A.icon:"&#xe9cb",this.options.visible=this.options.hasOwnProperty("visible")?A.visible:"hover",this.options.placement=this.options.hasOwnProperty("placement")?A.placement:"right",this.options.class=this.options.hasOwnProperty("class")?A.class:""},this._applyRemainingDefaultOptions(A),this.add=function(A){var
 e,t,o,n,i,s,a,l,c,r,h,g,B,Q; [...]
+// @license 
magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
+//
+// AnchorJS - v5.0.0 - 2023-01-18
+// https://www.bryanbraun.com/anchorjs/
+// Copyright (c) 2023 Bryan Braun; Licensed MIT
+//
+// @license 
magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
+!function(A,e){"use strict";"function"==typeof 
define&&define.amd?define([],e):"object"==typeof 
module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new 
A.AnchorJS)}(globalThis,function(){"use strict";return function(A){function 
u(A){A.icon=Object.prototype.hasOwnProperty.call(A,"icon")?A.icon:"",A.visible=Object.prototype.hasOwnProperty.call(A,"visible")?A.visible:"hover",A.placement=Object.prototype.hasOwnProperty.call(A,"placement")?A.placement:"right",A.ariaLabel=Obje
 [...]
+// @license-end
diff --git a/licenses-binary/LICENSE-AnchorJS.txt 
b/licenses-binary/LICENSE-AnchorJS.txt
index 2bf24b9b9f84..44d43b38e499 100644
--- a/licenses-binary/LICENSE-AnchorJS.txt
+++ b/licenses-binary/LICENSE-AnchorJS.txt
@@ -1,6 +1,6 @@
 The MIT License (MIT)
 
-Copyright (c) <year> <copyright holders>
+Copyright (c) 2023 Bryan Braun
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/licenses/LICENSE-AnchorJS.txt b/licenses/LICENSE-AnchorJS.txt
index 2bf24b9b9f84..44d43b38e499 100644
--- a/licenses/LICENSE-AnchorJS.txt
+++ b/licenses/LICENSE-AnchorJS.txt
@@ -1,6 +1,6 @@
 The MIT License (MIT)
 
-Copyright (c) <year> <copyright holders>
+Copyright (c) 2023 Bryan Braun
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to