Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,32 @@ const config = {
label: '<VERSION_NUMBER>',
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',
Expand Down
30 changes: 30 additions & 0 deletions src/theme/JavadocLink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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 <a> code below is generated based on the following JavadocLink component that must be added in place of a static Javadoc link in the doc:
// <JavadocLink packageName="<PACKAGE_NAME>" path="<PATH>" className="<CLASS_NAME>" />
// In addition, be sure to add the following below the title to import the component:
// import JavadocLink from "/src/theme/JavadocLink.js";
return (
<a
href={`https://javadoc.io/static/com.scalar-labs/${packageName}/${docsClassName}/${path}/${className}.html`}
target="_blank"
rel="noopener noreferrer"
>
{className}
</a>
);
}
Loading