• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 11 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“‹ A Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax.

Asciidoclet

Build Status Javadoc

Asciidoclet is a Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax.

Introduction

Traditionally, Javadocs have mixed minor markup with HTML which, if youโ€™re writing for HTML Javadoc output, becomes unreadable and hard to write over time. This is where lightweight markup languages like AsciiDoc thrive. AsciiDoc straddles the line between readable markup and beautifully rendered content.

Asciidoclet incorporates an AsciiDoc renderer (Asciidoctor via the Asciidoctor Java integration library) into a simple Doclet that enables AsciiDoc formatting within Javadoc comments and tags.

Example

Hereโ€™s an example of a class with traditional Javadoc.

A Java class with traditional Javadoc
/**
 * <h1>Asciidoclet</h1>
 *
 * <p>Sample comments that include {@code source code}.</p>
 *
 * <pre>{@code
 * public class Asciidoclet extends Doclet {
 *     private final Asciidoctor asciidoctor = Asciidoctor.Factory.create();
 *
 *     {@literal @}SuppressWarnings("UnusedDeclaration")
 *     public static boolean start(RootDoc rootDoc) {
 *         new Asciidoclet().render(rootDoc);
 *         return Standard.start(rootDoc);
 *     }
 * }
 * }</pre>
 *
 * @author <a href="https://github.com/johncarl81">John Ericksen</a>
 */
public class Asciidoclet extends Doclet {
}

This is the same class with Asciidoclet.

A Java class with Asciidoclet Javadoc
/**
 * = Asciidoclet
 *
 * Sample comments that include `source code`.
 *
 * [source,java]
 * --
 * public class Asciidoclet extends Doclet {
 *     private final Asciidoctor asciidoctor = Asciidoctor.Factory.create();
 *
 *     @SuppressWarnings("UnusedDeclaration")
 *     public static boolean start(RootDoc rootDoc) {
 *         new Asciidoclet().render(rootDoc);
 *         return Standard.start(rootDoc);
 *     }
 * }
 * --
 *
 * @author https://github.com/johncarl81[John Ericksen]
 */
public class Asciidoclet extends Doclet {
}

The result is readable source and beautifully rendered Javadocs, the best of both worlds!

Usage

Run Javadoc with the org.asciidoctor.Asciidoclet doclet class. Some examples for common build systems are shown below. See Doclet Options for supported options.

Maven

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

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.9</version>
    <configuration>
        <source>1.7</source>
        <doclet>org.asciidoctor.Asciidoclet</doclet>
        <docletArtifact>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoclet</artifactId>
            <version>${asciidoclet.version}</version>
        </docletArtifact>
        <overview>src/main/java/overview.adoc</overview>
        <additionalparam>
          --base-dir ${project.basedir}
          --attribute "name=${project.name}"
          --attribute "version=${project.version}"
          --attribute "title-link=https://example.com[${project.name} ${project.version}]"
        </additionalparam>
    </configuration>
</plugin>

Gradle

Asciidoclet may be used via a doclet in the Javadoc task:

configurations {
    asciidoclet
}

dependencies {
    asciidoclet 'org.asciidoctor:asciidoclet:1.+'
}

javadoc {
    options.docletpath = configurations.asciidoclet.files.asType(List)
    options.doclet = 'org.asciidoctor.Asciidoclet'
    options.overview = "src/main/java/overview.adoc"
    options.addStringOption "-base-dir", "${projectDir}" // (1)
    options.addStringOption "-attribute", // (2)
            "name=${project.name}," +
            "version=${project.version}," +
            "title-link=https://example.com[${project.name} ${project.version}]")
}
  1. Option names passed to Gradleโ€™s javadoc task must omit the leading "-", so here "-base-dir" means "--base-dir". See Doclet Options below.

  2. Gradleโ€™s javadoc task does not allow multiple occurrences of the same option. Multiple attributes can be specified in a single string, separated by commas.

Ant

Asciidoclet may be used via a doclet element in Antโ€™s javadoc task:

<javadoc destdir="target/javadoc"
         sourcepath="src"
         overview="src/overview.adoc">
  <doclet name="org.asciidoctor.Asciidoclet" pathref="asciidoclet.classpath"> <!--(1)-->
    <param name="--base-dir" value="${basedir}"/>
    <param name="--attribute" value="name=${ant.project.name}"/>
    <param name="--attribute" value="version=${version}"/>
    <param name="--attribute" value="title-link=https://example.com[${ant.project.name} ${version}]"/>
  </doclet>
</javadoc>
  1. Assumes a path reference has been defined for Asciidoclet and its dependencies, e.g. using Ivy or similar.

Doclet Options

--base-dir <dir>

Sets the base directory that will be used to resolve relative path names in Asciidoc include:: directives. This should be set to the projectโ€™s root directory.

-a, --attribute "name[=value], โ€ฆโ€‹"

Sets document attributes that will be expanded in Javadoc comments. The argument is a string containing a single attribute, or multiple attributes separated by commas.

This option may be used more than once, for example: -a name=foo -a version=1.

Attributes use the same syntax as Asciidoctor command-line attributes:

  • name sets the attribute (with an empty value)

  • name=value assigns value to the attribute. Occurrences of {name} in the Javadoc will be replaced by this value.

  • name=value@ assigns value to the attribute, unless the attribute is defined in the attributes file or Javadoc.

  • name! unsets the attribute.

The document attribute javadoc is set automatically by the doclet. This can be used for conditionally selecting content when using the same Asciidoc file for Javadoc and other documentation.

--attributes-file <file>

Reads document attributes from an Asciidoc file. The attributes will be expanded in Javadoc comments.

If <file> is a relative path name, it is assumed to be relative to the --base-dir directory.

Attributes set by the -a/--attribute option take precedence over those in the attributes file.

-r, --require <library>,โ€ฆโ€‹

Make the specified RubyGems library available to Asciidoctorโ€™s JRuby runtime, for example -r asciidoctor-diagram.

This option may be specified more than once. Alternatively multiple library names may be specified in a single argument, separated by commas.

--gem-path <path>

Sets the GEM_PATH for Asciidoctorโ€™s JRuby runtime. This option is only needed when using the --require option to load additional gems on the GEM_PATH.

-overview <file>

Overview documentation can be generated from an Asciidoc file using the standard -overview option. Files matching *.adoc, *.ad, *.asciidoc or *.txt are processed by Asciidoclet. Other files are assumed to be HTML and will be processed by the standard doclet.

--asciidoclet-include <filter>
--asciidoclet-exclude <filter>

Explicitly include or exclude classes from being processed as Asciidoc comments by ant-style path matching (see ant-style-path-matcher). If --asciidoclet-include is specified, only classes and packages matching the include filter are processed. Likewise, if --include is unspecified, all classes are processed. If --asciidoclet-exclude is specified, classes specifically matching the filter are not processed. --asciidoclet-include and --asciidoclet-exclude can be mixed. In addition, classes excluded with --asciidoclet-exclude or not matching a specified --asciidoclet-include may be included by annotating the class level javadoc with @asciidoclet. Doing so allows the ability to write one class at a time while respecting refactors. This feature allows the migration of documentation from HTML to Asciidoc in a piecemeal way

Log Warning

Currently there is a intermittent benign warning message that is emitted during a run of Asciidoclet stating the following:

WARN: tilt autoloading 'tilt/haml' in a non thread-safe way; explicit require 'tilt/haml' suggested.

Unfortunately, until the underlying library removes this warning message, it will be logged during the build.

Additional Features

Make sure to see Asciidoclet 1.5.0 Release Notes for additional features not documented here.

Resources and help

Powered by Asciidoclet

We have a Powered by Asciidoclet page. If you have an example of nifty JavaDoc powered by Asciidoclet, please send us a pull request.

License

Copyright (C) 2013-2015 John Ericksen

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

asciidoctor

๐Ÿ’Ž A fast, open source text processor and publishing toolchain, written in Ruby, for converting AsciiDoc content to HTML 5, DocBook 5, and other formats.
Ruby
4,437
star
2

asciidoctor-pdf

๐Ÿ“ƒ Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
Ruby
1,089
star
3

asciidoctor.js

๐Ÿ“œ A JavaScript port of Asciidoctor, a modern implementation of AsciiDoc
JavaScript
664
star
4

asciidoctorj

โ˜• Java bindings for Asciidoctor. Asciidoctor on the JVM!
Java
593
star
5

asciidoctor-diagram

โ†”๏ธ Asciidoctor diagram extension, with support for AsciiToSVG, BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag), Ditaa, Erd, GraphViz, Mermaid, Msc, PlantUML, Shaape, SvgBob, Syntrax, UMLet, Vega, Vega-Lite and WaveDrom.
Ruby
434
star
6

asciidoctor-intellij-plugin

AsciiDoc plugin for products on the IntelliJ platform (IDEA, RubyMine, etc)
Java
324
star
7

asciidoctor.org

๐ŸŒ Asciidoctor project site. Composed in AsciiDoc. Baked with Awestruct.
SCSS
308
star
8

asciidoctor-maven-plugin

A Maven plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
Java
298
star
9

jekyll-asciidoc

๐Ÿ’‰ A Jekyll plugin that converts AsciiDoc source files in your site to HTML pages using Asciidoctor.
Ruby
298
star
10

docker-asciidoctor

๐Ÿšข A Docker image for using the Asciidoctor toolchain to process AsciiDoc content
Shell
294
star
11

asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
TypeScript
281
star
12

asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
Groovy
272
star
13

asciidoctor-reveal.js

๐Ÿ”ฎ A reveal.js converter for Asciidoctor and Asciidoctor.js. Write your slides in AsciiDoc!
HTML
270
star
14

asciidoctor-epub3

๐Ÿ“˜ Asciidoctor EPUB3 is a set of Asciidoctor extensions for converting AsciiDoc to EPUB3 & KF8/MOBI
Ruby
203
star
15

asciidoctor-browser-extension

โšช An extension for web browsers that converts AsciiDoc files to HTML using Asciidoctor.js.
CSS
202
star
16

asciidoctor-maven-examples

A collection of example projects that demonstrates how to use the Asciidoctor Maven plugin.
Java
187
star
17

asciidoctor-stylesheet-factory

!DEPRECATED! This was the utility project for producing the default stylesheet for the HTML converter in Asciidoctor. The source of the default stylesheet now lives in the main Asciidoctor repository.
SCSS
178
star
18

kramdown-asciidoc

A kramdown extension for converting Markdown documents to AsciiDoc.
Ruby
174
star
19

asciidoctor-gradle-examples

A collection of example projects that demonstrates how to use the Asciidoctor Gradle plugin
Java
145
star
20

atom-asciidoc-preview

โš› AsciiDoc preview for the Atom editor.
CoffeeScript
142
star
21

asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
JavaScript
124
star
22

asciidoctor-fopub

A portable DocBook-to-PDF build command that wraps DocBook XSL and Apache FOP
Java
111
star
23

asciidoctor-latex

๐Ÿ“ Add LaTeX features to AsciiDoc & convert AsciiDoc to LaTeX
Ruby
106
star
24

jekyll-asciidoc-quickstart

A template project for creating AsciiDoc-based websites using Jekyll.
CSS
105
star
25

asciidoctor-extensions-lab

A lab for testing and demonstrating Asciidoctor extensions. Please do not use this code in production. If you want to use one of these extensions in your application, create a new project, import the code, and distribute it as a RubyGem. You can then request to make it a top-level project under the Asciidoctor organization.
Ruby
97
star
26

asciidoctor-confluence

Push Asciidoctor file to Confluence
Ruby
80
star
27

asciidoctor-backends

Backends (i.e., templates) for Asciidoctor, a Ruby port of AsciiDoc.
HTML
66
star
28

asciidoctor-bibtex

Add bibtex citation support for asciidoc documents
Ruby
59
star
29

docgist

Render AsciiDoc documents from Gists, GitHub, DropBox and other remote sources in the browser.
CSS
56
star
30

asciidoc-docs

The source files in this repository served as the initial contribution for the AsciiDoc Language specification project at Eclipse. This repository is now archived.
55
star
31

brackets-asciidoc-preview

Live Preview of AsciiDoc for Adobe Brackets
JavaScript
51
star
32

asciidoctor-bespoke

๐Ÿ…ฑ๏ธ An Asciidoctor converter that generates the HTML component of a Bespoke.js presentation from AsciiDoc.
Slim
49
star
33

sublimetext-asciidoc

AsciiDoc Package for SublimeText 3
Python
49
star
34

asciidoctor-mathematical

An extension for Asciidoctor that converts the content of STEM blocks and inline macros using Mathematical.
Ruby
44
star
35

atom-language-asciidoc

โš› AsciiDoc language package for the Atom editor.
CoffeeScript
42
star
36

asciidoctorj-pdf

AsciidoctorJ PDF bundles the Asciidoctor PDF RubyGem (asciidoctor-pdf) so it can be loaded into the JVM using JRuby.
Java
33
star
37

asciidoctor-firefox-addon

๐Ÿบ An add-on for Mozilla Firefox that converts AsciiDoc files to HTML directly in the browser using Asciidoctor.js.
JavaScript
32
star
38

asciidoctorj-screenshot

A set of AsciidoctorJ extensions for adding automated screenshots to an AsciiDoc document.
Groovy
32
star
39

asciidoctor-tabs

An extension for Asciidoctor that adds a tabs block to the AsciiDoc syntax.
Ruby
29
star
40

asciidoctor-lein-plugin

A Leiningen plugin for generating documentation using Asciidoctor
Clojure
26
star
41

asciidoctor-chart

A set of Asciidoctor extensions that add a chart block and block macro to AsciiDoc for including charts in your AsciiDoc document.
Ruby
25
star
42

asciidoctor-reducer

โš—๏ธ A tool to generate a single AsciiDoc document by expanding all the include directives reachable from the parent document.
Ruby
24
star
43

asciimath

Asciimath parser
Ruby
23
star
44

docbookrx

(An early version of) a DocBook to AsciiDoc converter written in Ruby.
Ruby
22
star
45

gitbucket-asciidoctor-plugin

A GitBucket plug-in that provided AsciiDoc rendering capabilities
Scala
18
star
46

asciidoctor-leanpub-converter

A backend for AsciidoctorJ to generate Leanpub-flavoured Markdown
Groovy
16
star
47

codemirror-asciidoc

AsciiDoc mode for CodeMirror
JavaScript
16
star
48

asciidoc-grammar-prototype

โ›” ARCHIVED: An experiment to create of a formal grammar for the AsciiDoc markup language. Work is being continued at https://github.com/Mogztter/asciidoctor-inline-parser.
Java
16
star
49

asciidoctor-cli.js

The Command Line Interface (CLI) for Asciidoctor.js
JavaScript
15
star
50

asciidoctor-documentation-planning

โ›” ARCHIVED: Planning for the documentation that covers the AsciiDoc syntax, the Asciidoctor processor, and various projects in the Asciidoctor ecosystem.
15
star
51

asciidoctorj-groovy-dsl

A Groovy DSL that allows for easy definition of Asciidoctor extensions
Groovy
14
star
52

gulp-asciidoctor

gulp-asciidoctor
JavaScript
14
star
53

asciidoctor-docs-ui

The project that produces the UI (theme & user interactions) for docs.asciidoctor.org.
CSS
12
star
54

docs.asciidoctor.org

The Antora playbook project (i.e., site manifest) for the Asciidoctor documentation site.
JavaScript
11
star
55

asciidoctor-deck.js

โ›” ARCHIVED: deck.js converter templates for Asciidoctor, implemented in Haml
HTML
11
star
56

asciidoctor-doctest

๐Ÿ”จ Test suite for Asciidoctor backends
Ruby
10
star
57

asciidoctorj-reveal.js

AsciidoctorJ Reveal.js bundles the Asciidoctor Reveal.js RubyGem (asciidoctor-revealjs) so it can be loaded into the JVM using JRuby
Java
10
star
58

asciidoctor-ant

๐Ÿœ Ant task to render Asciidoc documentation
Ruby
9
star
59

asciidoctor-diagram-java

Java
9
star
60

asciidoctorj-diagram

AsciidoctorJ Diagram bundles the Asciidoctor Diagram RubyGem (asciidoctor-diagram) so it can be loaded into the JVM using JRuby.
Java
9
star
61

atom-asciidoc-image-helper

โš› Tool to make insertion of images into AsciiDocs easier in the Atom editor.
CoffeeScript
9
star
62

atom-asciidoc-assistant

โš› AsciiDoc Assistant package for the Atom editor.
Shell
9
star
63

asciidoctor-chrome-editor

โ›” ARCHIVED: AsciiDoc Editor inside Chrome!
JavaScript
8
star
64

guard-asciidoc

Guard::AsciiDoc monitors and automatically renders your AsciiDoc documents using Asciidoctor
Ruby
8
star
65

atom-autocomplete-asciidoc

โš› AsciiDoc language autocompletions
CoffeeScript
7
star
66

asciidoctor-docbook.js

DocBook converter for Asciidoctor.js
JavaScript
7
star
67

asciidoctor-mallard

A Mallard 1.0 converter for Asciidoctor
Ruby
6
star
68

asciidoctor-lazybones

Lazybones templates for Asciidoctor projects
Groovy
5
star
69

asciidoctor-fb2

๐Ÿ“• Asciidoctor FB2 is an Asciidoctor extension for converting AsciiDoc to FB2
Ruby
5
star
70

html-pipeline-asciidoc_filter

โ›” ARCHIVED: An AsciiDoc processing filter for html-pipeline based on Asciidoctor.
Ruby
5
star
71

brand

Brand assets and visual identity for the Asciidoctor project
Shell
4
star
72

opal-node-runtime

โšก๏ธ Opal Runtime specifically designed for Asciidoctor
JavaScript
4
star
73

asciidoctor-template.js

โ›”๏ธ DEPRECATED: Generic template backend for Asciidoctor.js
JavaScript
4
star
74

asciidoctor-deb-mirror

A mirror of the asciidoctor deb (Debian) package build in the pkg-ruby-extras package group. DO NOT PUSH CHANGES TO THIS MIRROR.
Ruby
3
star
75

docker-asciidoctorj

Ensure that AsciidoctorJ can be used by apps into a Java Application Server (WildFly AS for now)
Java
3
star
76

asciidoctor-community-docs

Process, policy, and other shared documentation for the Asciidoctor community of projects.
3
star
77

asciidoctorj-chart

AsciidoctorJ Chart bundles the Asciidoctor Chart RubyGem (asciidoctor-chart) so it can be loaded into the JVM using JRuby.
HTML
3
star
78

asciidoctor-grunt-plugin

A Grunt plugin that uses Asciidoctor via Asciidoctor.js to process AsciiDoc source files within the project.
HTML
2
star
79

asciidoctor-rpm-mirror

A mirror of the package spec for the rubygem-asciidoctor (alias: asciidoctor) rpm. DO NOT PUSH CHANGES TO THIS MIRROR.
Ruby
2
star
80

default-to-asciidoc-chrome-extension

You love AsciiDoc and you want it to be the default option, this extension is for you!
JavaScript
2
star
81

asciidoctorj-epub3

AsciidoctorJ EPUB3 bundles the Asciidoctor EPUB3 RubyGem (asciidoctor-epub3) so it can be loaded into the JVM using JRuby.
Java
1
star
82

asciidoctor-docbook45

!DEPRECATED! An Asciidoctor converter that converts AsciiDoc to DocBook 4.5. This converter is community maintained and will not be released. Use the built-in DocBook 5 converter instead.
Ruby
1
star