org.asciidoctor
Class Asciidoclet

java.lang.Object
  extended by com.sun.javadoc.Doclet
      extended by org.asciidoctor.Asciidoclet

public class Asciidoclet
extends com.sun.javadoc.Doclet

Asciidoclet

Asciidoclet is a Javadoc Doclet that uses Asciidoctor (via the Asciidoctor Java integration) to render AsciiDoc markup within Javadoc comments.

Usage

Asciidoclet may be used via a custom doclet in the maven-javadoc-plugin:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <source>1.7</source>
                    <doclet>org.asciidoctor.Asciidoclet</doclet>
                    <docletArtifact>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoclet</artifactId>
                        <version>${project.version}</version>
                    </docletArtifact>
                    <additionalparam>-include-basedir ${project.basedir}</additionalparam>  <!-- <1> -->
                    <linksource>true</linksource>
                </configuration>
            </plugin>
  1. The -includes-basedir option must be set, typically this is the project root. It allows source inclusions within javadocs, relative to the specified directory.

Examples

Code block (with syntax highlighting added by CodeRay)
/**
 * = Asciidoclet
 *
 * A Javadoc Doclet that uses http://asciidoctor.org[Asciidoctor]
 * to render http://asciidoc.org[AsciiDoc] markup in Javadoc comments.
 *
 * @author https://github.com/johncarl81[John Ericksen]
 */
public class Asciidoclet extends Doclet {
    private final Asciidoctor asciidoctor = Asciidoctor.Factory.create(); // <1>

    @SuppressWarnings("UnusedDeclaration")
    public static boolean start(RootDoc rootDoc) {
        new Asciidoclet().render(rootDoc); // <2>
        return Standard.start(rootDoc);
    }
}
  1. Creates an instance of the Asciidoctor Java integration

  2. Runs Javadoc comment strings through Asciidoctor

Inline code

code() or code()

Headings

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Links

Doc Writer <doc@example.com>
AsciiDoc is a lightweight markup language.
Learn more about it at http://asciidoctor.org.

Bullets
Unnumbered
  • bullet

  • bullet

    • bullet

    • bullet

  • bullet

    • bullet

    • bullet

      • bullet

      • bullet

        • bullet

        • bullet

          • bullet

          • bullet

        • bullet

      • bullet

    • bullet

  • bullet

Numbered
  1. bullet

  2. bullet

    1. bullet

    2. bullet

  3. bullet

    1. bullet

      1. bullet

      2. bullet

        1. bullet

        2. bullet

      3. bullet

      4. bullet

    2. bullet

    3. bullet

  4. bullet

Tables
Table 1. An example table
Column 1 Column 2 Column 3

1

Item 1

a

2

Item 2

b

3

Item 3

c

Sidebar block
Optional Title

Sidebar Block

Usage: Notes in a sidebar, naturally.

Admonitions
Important
Check this out!

Since:
0.1.0
Version:
0.1.0
Author:
John Ericksen
See Also:
Asciidoclet

Constructor Summary
Asciidoclet()
           
 
Method Summary
static void exampleDeprecated(String field)
          Deprecated. for example purposes
static com.sun.javadoc.LanguageVersion languageVersion()
          
static int optionLength(String option)
          
static boolean start(com.sun.javadoc.RootDoc rootDoc)
          
static boolean validOptions(String[][] options, com.sun.javadoc.DocErrorReporter errorReporter)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Asciidoclet

public Asciidoclet()
Method Detail

exampleDeprecated

public static void exampleDeprecated(String field)
                              throws Exception
Deprecated. for example purposes

Example usage
exampleDeprecated("do not use");

Throws:
Exception - example
RuntimeException - example

languageVersion

public static com.sun.javadoc.LanguageVersion languageVersion()

Sets the language version to Java 5.

Javadoc spec requirement.

Returns:
language version number

optionLength

public static int optionLength(String option)

Sets the option length to the standard Javadoc option length.

Javadoc spec requirement.

Parameters:
option - input option
Returns:
length of required parameters

start

public static boolean start(com.sun.javadoc.RootDoc rootDoc)

The starting point of Javadoc render.

Javadoc spec requirement.

Parameters:
rootDoc - input class documents
Returns:
success

validOptions

public static boolean validOptions(String[][] options,
                                   com.sun.javadoc.DocErrorReporter errorReporter)

Processes the input options by delegating to the standard handler.

Javadoc spec requirement.

Parameters:
options - input option array
errorReporter - error handling
Returns:
success


Copyright © 2013. All Rights Reserved.