OrchidJavadoc

Where Orchid began. Create beautiful Javadocs for your project within your Orchid site.


About

The OrchidJavadoc plugin integrates with the Javadoc tool to embed class and package info from Java source code directly in your Orchid site.

The suite of Orchid Sourcedocs plugins are for designed for merging source code documentation with the rest of your project site.

Orchid Sourcedocs supports multi-module projects with READMEs and separate doc groups for each module, customizable permalinks, auto-updating menu items, and an ever-improving data model to link to doc pages and display the relationships among different elements.

It also integrates client-side full-text search from the OrchidSearch plugin and is set up for easy page querying or archive generation with the OrchidTaxonomies plugin.

The following languages are currently supported:

Support for the legacy javadoc plugin will be removed in version 0.22.0. Until version 0.21.0, legacy javadocs were the default, but now they are end-of-life and must be enabled with the --legacySourceDoc CLI flag.

Installation

dependencies {
    orchidRuntime("io.github.javaeden.orchid:OrchidJavadoc:0.21.0")
}
<dependency>
    <groupId>io.github.javaeden.orchid</groupId>
    <artifactId>OrchidJavadoc</artifactId>
    <version>0.21.0</version>
    <type>pom</type>
</dependency>
libraryDependencies += "io.github.javaeden.orchid" % "OrchidJavadoc" % "0.21.0"
@file:DependsOn("io.github.javaeden.orchid:OrchidJavadoc:0.21.0")

Demo

Single-Module Usage

Configuration

An example of single-module configuration is below. Most properties are optional.

javadoc:
  name: 'Project Name'
  sourceDirs: ['../module-one/src/main/java']
  homePagePermalink: '...'
  sourcePagePermalink: '...'
  showRunnerLogs: false
  homePageOnly: false
  args: []
DescriptionOptionDefault Value
The name of the module, which becomes the title of the module Homepage.namefalse
Relative paths to directories containing Java source code.sourceDirs[]
Customize the URL path for the homepage.homePagePermalinksee below
Customize the URL path for class and package pages.sourcePagePermalinksee below
Whether to print logs from the underlying Javadoc CLIshowRunnerLogsfalse
If true, do not run Javaodc. Create docs a module with only a homepage.homePageOnlyfalse
Additional args to pass-through to the Javadoc CLI.args[]

Permalinks can be customized for all pages generated by this plugin. For each module, you can set homePagePermalink or sourcePagePermalink with your desired permalink string. The following dynamic path segments are available for these pages (in addition to the standard permalink keys):

  • :moduleType - The "type" of source code you're documenting (javadoc)
  • :moduleGroup - Not used for single-module docs
  • :module - Not used for single-module docs
  • :sourceDocPath - The path for each source code doc page, as defined by the Javadoc plugin

The default permalinks are as follows:

DescriptionPermalink patternExample
Module home pages:moduleType/:moduleGroup/:module/javadoc
Source code pages:moduleType/:moduleGroup/:module/:sourceDocPath/javadoc/com/app/mainapplication

Page Archetypes

The pages generated have several archetype keys available, for applying options to these pages in varying levels of granularity:

DescriptionArchetype Pattern
Both module home and source code pages for all languagessourcedoc.pages
Just module home pages for all languagessourcedoc.moduleHomePages
Just source code pages for all languagessourcedoc.sourcePages
Java module home and source code pagesjavadoc.pages
Just Java module home pagesjavadoc.moduleHomePages
Just Java source code pagesjavadoc.sourcePages
Just Java Class source code pagesjavadoc.classesPages
Just Java Package source code pagesjavadoc.packagesPages

Collections

SourceDocs generate a variety of collections which allow you to precisely query these pages. All collections will have a collectionType of the moduleType (javadoc).

For a single module, you will get a collection with collectionId of the moduleType. For each of these collections, it will also contain related collections containing the source pages of a specific page types, classes and packages. In addition, you will have a modules collection, which contains the READMEs for each module.

DescriptionCollection TypeCollection ID
All Javadoc pagesjavadocjavadoc
All Javadoc class pagesjavadocjavadoc-classes
All Javadoc package pagesjavadocjavadoc-packages
The Javadoc README pagejavadocjavadoc-modules

There are 3 types of menu items available

Modules

Create a menu item linking to the module home pages. Typically added to the Theme menu so it is added to all pages.

theme:
  menu:
    - type: 'sourcedocModules'
      moduleType: 'javadoc'

Pages

Create a menu item linking to all the source pages for a single module. You can optionally filter it by page type, or include all source pages for that module. Typically added to the Theme menu so it is added to all pages.

theme:
  menu:
    - type: 'sourcedocPages'
      moduleType: 'javadoc'
      node: 'classes' # optional

By default, all menu items will display the title of the linked page, which is typically a human-readable version of the documented element. You can set itemTitleType: 'ID' to have it display the actual page element ID.

theme:
  menu:
    - type: 'sourcedocPages'
      moduleType: 'javadoc'
      node: 'classes'
      itemTitleType: 'ID'

In addition, you can provide an inline Pebble template to render/transform the menu item title however you need. You have access to the original title, the target page, and the element within that template.

theme:
  menu:
    - type: 'sourcedocPages'
      moduleType: 'javadoc'
      node: 'classes'
      itemTitleType: 'ID'
      transform: '{{ title|replace({"com.eden.orchid": "c.e.o"}) }}'

Page Links adds menu item links to a single SourceDoc Page. It links to each "section" on that page (such as methods, constructors, or fields on a classes page). Setting includeItems: true will optionally include all that items for each section. It is typically added to a Page's menu item through one of the above Archetypes.

Just like sourcedocPages, you can customize how the menu item text is rendered with itemTitleType. It can be NAME for the element's human-readable name, ID for the actual element ID, or signature to display the fully-formatted element signature.

javadoc:
  sourcePages:
    menu:
      - type: 'sourcedocPageLinks'
        itemTitleType: 'signature' # optional, one of [NAME, ID, SIGNATURE]
        includeItems: true # optional

Filtering Docs

TODO: add docs for filtering Javadocs

Multi-Module Usage

Configuration

An example of multi-module configuration is below. Most properties are optional.

javadoc:
  modules:
    - name: 'project-1-name'
      slug: 'project-1'
      moduleGroup: 'group-a'
      sourceDirs: ['../module-one/src/main/java']
      homePagePermalink: '...'
      sourcePagePermalink: '...'
      showRunnerLogs: false
      homePageOnly: false
      relatedModules: ['project-2-name']
      args: []
    - name: 'project-2-name'
      ...
DescriptionOptionDefault Value
The name of the module, which becomes the title of the module Homepage.namefalse
The slug prepended to page URLs from this module.slug``
Group multiple modules together for easier configuration and improved site hierarchy.moduleGroup[]
Relative paths to directories containing Java or Java source code.sourceDirs[]
Customize the URL path for the homepage.homePagePermalinksee below
Customize the URL path for class and package pages.sourcePagePermalinksee below
Whether to print logs from the underlying Javadoc CLIshowRunnerLogsfalse
If true, do not run Javadoc. Create docs a module with only a homepage.homePageOnlyfalse
A list of other modules which contain sources that may be linked to by the pages in this modulerelatedModules[]
Additional args to pass-through to the Javadoc CLI.args[]

Permalinks can be customized for all pages generated by this plugin. For each module, you can set homePagePermalink or sourcePagePermalink with your desired permalink string. The following dynamic path segments are available for these pages (in addition to the standard permalink keys):

  • :moduleType - The "type" of source code you're documenting (javadoc)
  • :moduleGroup - The module group at declared in the module configuration
  • :module - The name of this specific module
  • :sourceDocPath - The path for each source code doc page, as defined by the Javadoc plugin

The default permalinks are as follows:

DescriptionPermalink patternExample without module groupExample with module group
Module home pages:moduleType/:moduleGroup/:module/javadoc/project-1/javadoc/group-a/project-1
Source code pages:moduleType/:moduleGroup/:module/:sourceDocPath/javadoc/project-1/com/app/mainapplication/javadoc/group-a/project-1/com/app/mainapplication

Page Archetypes

The pages generated have several archetype keys available, for applying options to these pages in varying levels of granularity:

DescriptionArchetype Pattern
Both module home and source code pages for all languagessourcedoc.pages
Just module home pages for all languagessourcedoc.moduleHomePages
Just source code pages for all languagessourcedoc.sourcePages
Java module home and source code pages for all modulesjavadoc.pages
Just Java module home pages for all modulesjavadoc.moduleHomePages
Just Java source code pages for all modulesjavadoc.sourcePages
Just Java Class source code pages for all modulesjavadoc.classesPages
Just Java Package source code pages for all modulesjavadoc.packagesPages
Java module home and source code pages for a single module groupjavadoc.[module group]Pages
Just Java module home pages for a single module groupjavadoc.[module group]ModuleHomePages
Just Java source code pages for a single module groupjavadoc.[module group]SourcePages
Just Java Class source code pages for a single module groupjavadoc.[module group]ClassesPages
Just Java Package source code pages for a single module groupjavadoc.[module group]PackagesPages

Collections

SourceDocs generate a variety of collections which allow you to precisely query these pages. All collections will have a collectionType of the moduleType (javadoc).

For multiple modules, you will get a collection for each module with collectionId of its name. For each of these collections, it will also contain related collections containing the source pages of a specific page types, classes and packages. In addition, you will have a single modules collection which contains the READMEs of all modules.

DescriptionCollection TypeCollection ID
All Javadoc pagesjavadoc[module name]
All Javadoc class pagesjavadoc[module name]-classes
All Javadoc package pagesjavadoc[module name]-packages
The Javadoc README pagejavadocjavadoc-modules

There are 3 types of menu items available

Modules

Create a menu item linking to the module home pages, optionally filtered by module group. Typically added to the Theme menu so it is added to all pages.

theme:
  menu:
    - type: 'sourcedocModules'
      moduleType: 'javadoc'
      moduleGroup: 'group-a' 

Pages

Create a menu item linking to all the source pages for a single module. You can optionally filter it by page type, or include all source pages for that module. Typically added to the Theme menu so it is added to all pages.

theme:
  menu:
    - type: 'sourcedocPages'
      moduleType: 'javadoc'
      moduleName: 'project-1-name'
      node: 'classes' # optional

By default, all menu items will display the title of the linked page, which is typically a human-readable version of the documented element. You can set itemTitleType: 'ID' to have it display the actual page element ID.

theme:
  menu:
    - type: 'sourcedocPages'
      moduleType: 'javadoc'
      moduleName: 'project-1-name'
      node: 'classes'
      itemTitleType: 'ID'

In addition, you can provide an inline Pebble template to render/transform the menu item title however you need. You have access to the original title, the target page, and the element within that template.

theme:
  menu:
    - type: 'sourcedocPages'
      moduleType: 'javadoc'
      moduleName: 'project-1-name'
      node: 'classes'
      itemTitleType: 'ID'
      transform: '{{ title|replace({"com.eden.orchid": "c.e.o"}) }}'

Page Links adds menu item links to a single SourceDoc Page. It links to each "section" on that page (such as methods, constructors, or fields on a classes page). Setting includeItems: true will optionally include all that items for each section. It is typically added to a Page's menu item through one of the above Archetypes.

Just like sourcedocPages, you can customize how the menu item text is rendered with itemTitleType. It can be NAME for the element's human-readable name, ID for the actual element ID, or signature to display the fully-formatted element signature.

javadoc:
  sourcePages:
    menu:
      - type: 'sourcedocPageLinks'
        itemTitleType: 'signature' # optional, one of [NAME, ID, SIGNATURE]
        includeItems: true # optional

Filtering Docs

TODO: add docs for filtering Javadocs