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

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne-website.git

commit 8877d2662ab27a640accbc08d117996dc8377b79
Author: Nikita Timofeev <stari...@gmail.com>
AuthorDate: Wed Nov 13 17:25:35 2019 +0300

    Add anchor links to documentation
---
 src/main/assets/package.json    |  3 ++-
 src/main/assets/scripts/main.js | 25 +++++++++++++++++++------
 src/main/assets/yarn.lock       |  5 +++++
 3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/src/main/assets/package.json b/src/main/assets/package.json
index 918c321..e0af47c 100644
--- a/src/main/assets/package.json
+++ b/src/main/assets/package.json
@@ -7,7 +7,8 @@
     "bootstrap": "4.3.1",
     "popper.js": "1.14.7",
     "highlight.js": "9.15.6",
-    "font-awesome": "4.7.0"
+    "font-awesome": "4.7.0",
+    "anchor-js": "4.2.1"
   },
   "devDependencies" : {
     "gulp": "^3.9.1",
diff --git a/src/main/assets/scripts/main.js b/src/main/assets/scripts/main.js
index 897baef..b32a426 100644
--- a/src/main/assets/scripts/main.js
+++ b/src/main/assets/scripts/main.js
@@ -22,13 +22,15 @@ require('bootstrap/js/dist/collapse');
 require('bootstrap/js/dist/dropdown');
 require('bootstrap/js/dist/scrollspy');
 
-function initHljs() {
-    var hljs    = require('highlight.js/lib/highlight.js');
-    var xml     = require('highlight.js/lib/languages/xml.js');
-    var java    = require('highlight.js/lib/languages/java.js');
-    var sql     = require('highlight.js/lib/languages/sql.js');
-    var groovy  = require('highlight.js/lib/languages/groovy.js');
+var anchorJS = require('anchor-js');
+
+var hljs     = require('highlight.js/lib/highlight.js');
+var xml      = require('highlight.js/lib/languages/xml.js');
+var java     = require('highlight.js/lib/languages/java.js');
+var sql      = require('highlight.js/lib/languages/sql.js');
+var groovy   = require('highlight.js/lib/languages/groovy.js');
 
+function initHljs() {
     hljs.registerLanguage('xml',    xml);
     hljs.registerLanguage('java',   java);
     hljs.registerLanguage('sql',    sql);
@@ -43,8 +45,19 @@ function initGitHubBadge() {
     });
 }
 
+function initAnchors() {
+    var anchors = new anchorJS();
+    anchors
+        .add(".cd-content h2")
+        .add(".cd-content h3")
+        .add(".cd-content h4")
+        .add(".cd-content h5")
+        .add(".cd-content h6");
+}
+
 $(document).ready(function () {
     initHljs();
+    initAnchors();
     initGitHubBadge();
 });
 
diff --git a/src/main/assets/yarn.lock b/src/main/assets/yarn.lock
index 65e6377..7eeffbb 100644
--- a/src/main/assets/yarn.lock
+++ b/src/main/assets/yarn.lock
@@ -75,6 +75,11 @@ amdefine@>=0.0.4:
   version "1.0.1"
   resolved 
"https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5";
 
+anchor-js@4.2.1:
+  version "4.2.1"
+  resolved 
"https://registry.yarnpkg.com/anchor-js/-/anchor-js-4.2.1.tgz#983d40b4950c07bca838242e4f46606dfbba49ae";
+  integrity 
sha512-v2NFSBkEoal1GatM8YoL9bV1mS9729Xs1vIvASNKCQH16BgRiyFi6pqGdbtEXzUCwm6i5DRG0kYlhAEkMdCw5g==
+
 ansi-regex@^0.2.0, ansi-regex@^0.2.1:
   version "0.2.1"
   resolved 
"https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-0.2.1.tgz#0d8e946967a3d8143f93e24e298525fc1b2235f9";

Reply via email to