From af32adf8d18cef52c4ac18145d66a594999cbba8 Mon Sep 17 00:00:00 2001
From: Josh Wong <23216828+josh-wong@users.noreply.github.com>
Date: Thu, 26 Dec 2024 14:50:08 +0900
Subject: [PATCH 1/3] Create JavadocLink.js
---
src/theme/JavadocLink.js | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 src/theme/JavadocLink.js
diff --git a/src/theme/JavadocLink.js b/src/theme/JavadocLink.js
new file mode 100644
index 00000000..e1398a8a
--- /dev/null
+++ b/src/theme/JavadocLink.js
@@ -0,0 +1,28 @@
+import React from 'react';
+import { useActiveVersion } from '@docusaurus/plugin-content-docs/client';
+import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
+
+export default function JavadocLink({ packageName, path, className }) {
+ const { siteConfig } = useDocusaurusContext();
+ const activeVersion = useActiveVersion();
+
+ // Retrieve className from siteConfig based on the active version.
+ const docsClassName =
+ siteConfig.presets?.[0]?.[1]?.docs?.versions?.[activeVersion.name]?.className;
+
+ // Log for debugging
+ console.log('Active Version:', activeVersion?.name);
+ console.log('Docs ClassName:', docsClassName);
+
+ // The link in the code below is generated based on the following JavadocLink component that must be added in place of a static Javadoc link in the doc:
+ //
+ return (
+
+ {className}
+
+ );
+}
From 4788a05f6f934d563d91c5611de348e30fd75518 Mon Sep 17 00:00:00 2001
From: Josh Wong <23216828+josh-wong@users.noreply.github.com>
Date: Thu, 26 Dec 2024 14:50:42 +0900
Subject: [PATCH 2/3] Add `className` to versions for JavadocLink use
---
docusaurus.config.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/docusaurus.config.js b/docusaurus.config.js
index 4cc65b03..79d9ab4b 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -69,27 +69,32 @@ const config = {
label: '',
path: 'latest', // When a new version is released and this is no longer the current version, change this to the version number and then delete this comment.
banner: 'none',
+ className: 'X.X.X', // This should be the most recent version (major.minor.patch) so that the Javadoc links point to the latest version based on the major.minor version that the visitor is viewing on the docs site.
},
*/
current: { // When a new version is released and this is no longer the current version, change this to the version number and then delete this comment.
label: '3.14',
path: 'latest', // When a new version is released and this is no longer the current version, change this to the version number and then delete this comment.
banner: 'none',
+ className: '3.14.0',
},
"3.13": {
label: '3.13',
path: '3.13',
banner: 'none',
+ className: '3.13.1',
},
"3.12": {
label: '3.12',
path: '3.12',
banner: 'none',
+ className: '3.12.4',
},
"3.11": {
label: '3.11',
path: '3.11',
banner: 'none',
+ className: '3.11.4',
},
"3.10": {
label: '3.10',
From 6e19fa9b49a64e5d03351e037dedbabec524a6a4 Mon Sep 17 00:00:00 2001
From: Josh Wong <23216828+josh-wong@users.noreply.github.com>
Date: Thu, 26 Dec 2024 16:46:53 +0900
Subject: [PATCH 3/3] Add instruction in comment
---
src/theme/JavadocLink.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/theme/JavadocLink.js b/src/theme/JavadocLink.js
index e1398a8a..c00f658c 100644
--- a/src/theme/JavadocLink.js
+++ b/src/theme/JavadocLink.js
@@ -15,7 +15,9 @@ export default function JavadocLink({ packageName, path, className }) {
console.log('Docs ClassName:', docsClassName);
// The link in the code below is generated based on the following JavadocLink component that must be added in place of a static Javadoc link in the doc:
- //
+ //
+ // In addition, be sure to add the following below the title to import the component:
+ // import JavadocLink from "/src/theme/JavadocLink.js";
return (