Skip to content

xiaowangzhixiao/JavaDocMark

Repository files navigation

JavadocMark

In the era of AI-powered code editors like Cursor, developers often face challenges when working with newer Java dependencies. Traditional Javadoc documentation, while comprehensive, isn't always directly accessible to AI models. This limitation can lead to generated code that doesn't fully align with the latest API interfaces.

JavadocMark was created to bridge this gap. It generates Javadoc documentation in Markdown format, which can be directly included in your project. This approach enables AI models to read and understand the documentation more effectively, significantly improving the accuracy of generated code that uses modern Java libraries.

JavadocMark is a custom Java Doclet that generates Javadoc documentation in Markdown format, ready to use on GitHub. You can check the documentation generated by JavadocMark in the following project:

Main Features

  1. Generate package-level documentation (README.md), including:

    • Package name and description
    • Type table (classes, interfaces, enums) with names, types, and descriptions
    • Support for inner classes, with file names and titles including outer class names
  2. Generate type-level documentation (TypeName.md), including:

    • Type name and full description
    • Field list and descriptions
    • Method list with parameters, return values, and exception descriptions
    • Support for inner classes, with file names and titles including outer class names

Usage

Add the following configuration to your Maven project's POM file:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.9</version>
    <configuration>
        <doclet>com.manxiaozhi.javadocmark.JavadocMark</doclet>
        <docletArtifact>
            <groupId>com.manxiaozhi</groupId>
            <artifactId>javadocmark</artifactId>
            <version>1.0.0</version>
        </docletArtifact>
        <reportOutputDirectory>./</reportOutputDirectory>
        <destDir>./</destDir>
        <additionalparam>-d javadoc/</additionalparam>
        <useStandardDocletOptions>false</useStandardDocletOptions>
    </configuration>
</plugin>

This will generate documentation in the javadoc/ subdirectory of your project.

Java8 doclint Issues

If you're using Java8, you might encounter doclint validation issues, especially when using markdown blockquote syntax. To resolve this, simply add the following configuration to your pom.xml file to disable doclint:

<properties>
    <additionalparam>-Xdoclint:none</additionalparam>
</properties>

Developing JavadocMark

JavadocMark requires Apache Maven. To build the project, run:

$ ./mvnw install

To generate Markdown documentation for JavadocMark itself, run:

$ ./mvnw -P javadocmark-generation javadoc:javadoc

License

JavadocMark is licensed under the Apache License, Version 2.0.

Current Version Features

The current version (1.0.1) supports the following features:

  • Generate package-level Markdown documentation
  • Generate type-level Markdown documentation
  • Support for inner class documentation generation
  • Support for interface and enum documentation generation
  • Support for detailed field and method documentation
  • Support for parameter, return value, and exception documentation

If you find any issues, please feel free to submit a Pull Request.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages