• Stars
    star
    593
  • Rank 75,443 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 11 years ago
  • Updated about 1 year ago

Reviews

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

Repository Details

☕ Java bindings for Asciidoctor. Asciidoctor on the JVM!

AsciidoctorJ: Java bindings for Asciidoctor

AsciidoctorJ is the official library for running Asciidoctor on the JVM. Using AsciidoctorJ, you can convert AsciiDoc content or analyze the structure of a parsed AsciiDoc document from Java and other JVM languages.

You can find the documentation for integrating Asciidoctor in your JVM based language of choice at the Asciidoctor Docs site.

Build Status (Github Actions) project chat

Distribution

AsciidoctorJ is published to Maven Central. The artifact information can be found in the tables below.

Table 1. Artifact information for AsciidoctorJ in Maven Central
Group Id Artifact Id Version Download

org.asciidoctor

asciidoctorj

2.5.7

pom jar javadoc (jar) sources (jar) distribution (zip tar)

org.asciidoctor

asciidoctorj-api

2.5.7

pom jar javadoc (jar) sources (jar)

org.asciidoctor

asciidoctorj-epub3

1.5.1

org.asciidoctor

asciidoctorj-pdf

1.6.2

🔥
The artifactId changed to asciidoctorj starting in 1.5.0.

Quick win: using the command line interface

If you download from a distribution link above (zip or tar), you can get started straight away from the command line.

First, expand the downloaded file. That puts everything in directory asciidoctorj-2.5.7. Within that directory are bin and lib directories. bin contains the executables — asciidoctorj for Linux and macOS, and asciidoctorj.bat for Windows. lib contains the supporting libraries.

Verify the application runs by specifying the appropriate executable with no parameters; it should display the various run options available (i.e., help).

Linux: asciidoctorj-2.5.7/bin/asciidoctorj
Windows: asciidoctorj-2.5.7\bin\asciidoctorj.bat

Next, say you want to convert an ASCIIDOC (.adoc) file — such as this README — to a pdf.

Linux: asciidoctorj-2.5.7/bin/asciidoctorj -b pdf README.adoc
Windows: asciidoctorj-2.5.7\bin\asciidoctorj.bat -b pdf README.adoc

Boom! That should convert the README to a PDF named README.pdf. To create a PDF with a different name — say, READTHIS.pdf — just add the -o switch:

Linux: asciidoctorj-2.5.7/bin/asciidoctorj -b pdf -o READTHIS.pdf README.adoc
Windows: asciidoctorj-2.5.7\bin\asciidoctorj.bat -b pdf -o READTHIS.pdf README.adoc

The rest of the document addresses the asciidoctorj API, for doing more complex conversions from within a JVM-based application.

Installation

To start using AsciidoctorJ, you need to add the required dependency to the dependency management system of your choice, Maven, Gradle or Apache Ivy. If you don’t use a Dependency Management system please check the dependency graph and add all jars in it to your classpath.

Declaring the dependency in a Maven build file (i.e., pom.xml)
<dependencies>
  <dependency>
    <groupId>org.asciidoctor</groupId>
    <artifactId>asciidoctorj</artifactId>
    <version>2.5.7</version> <!--(1)-->
  </dependency>
</dependencies>
Declaring the dependency in a Gradle build file (e.g., build.gradle)
dependencies {
  compile 'org.asciidoctor:asciidoctorj:2.5.7'
}
Declaring the dependency in an SBT build file (e.g., build.sbt)
libraryDependencies += "org.asciidoctor" % "asciidoctorj" % "2.5.7" // (1)
  1. Specifying the version of AsciidoctorJ implicitly selects the version of Asciidoctor

Declaring the dependency in a Leiningen build file (e.g., project.clj)
:dependencies [[org.asciidoctor/asciidoctorj "2.5.7"]]
💡

In addition to using AsciidoctorJ directly, you can invoke it as part of your build using the Maven or Gradle plugin.

📎
The versions of Asciidoctor and AsciidoctorJ no longer align since version 1.6.0 of AsciidoctorJ. Please check the corresponding release notes to find out which version of Asciidoctor is packaged if you are embedding the library. If you use the distribution you can call asciidoctorj --version to get the version of Asciidoctor that is embedded in AsciidoctorJ.

Windows Installation

A Chocolatey package is available which installs the asciidoctorj-2.5.7-bin.zip Maven artifact along with a binary shim in %ChocolateyInstall%\bin which lets you run AsciidoctorJ from the command line.

C:\> choco install asciidoctorj
C:\> where asciidoctorj
C:\ProgramData\chocolatey\bin\asciidoctorj.exe
C:\> asciidoctorj -b pdf README.adoc

Using a pre-release version

Pre-release versions of AsciidoctorJ are published to oss.sonatype.org. The exact location of the repository will be announced. Final releases are released to both Maven Central.

Here’s how to use a pre-release version in Maven:

    <repositories>
        <repository>
            <id>staging</id>
            <url>https://oss.sonatype.org/content/repositories/orgasciidoctor-1234</url> <!--(1)-->
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>
  1. The exact URL differs for every build

Using a snapshot version

Snapshot versions will be published to https://oss.jfrog.org. To use a snapshot version of the the AsciidoctorJ library add this repository to your project:

<repositories>
    <repository>
        <id>snapshots</id>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </repository>
</repositories>

If you build your project using Gradle add the repository like this to your build:

repositories {
    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
}

Development

AsciidoctorJ is built using Gradle. The project is structured as a multi-module build.

Project layout

The root folder is the root project and there are several subproject folders, each prefixed with asciidoctorj-. Each subproject produces a primary artifact (e.g., jar or zip) and its supporting artifacts (e.g., javadoc, sources, etc).

The subprojects are as follows:

asciidoctorj-api

The common API for AsciidoctorJ. Other implementations for different platforms than JRuby may reuse and implement this API. Produces the asciidoctorj-api.jar

asciidoctorj

The main Java bindings for the Asciidoctor RubyGem (asciidoctor) running on JRuby. Also bundles optional RubyGems needed at runtime, such as coderay, tilt, haml and slim. Produces the asciidoctorj jar.

asciidoctorj-cli

asciidoctorj command Java components. Produces the asciidoctorj-cli.

asciidoctorj-distribution

Produces the distribution zip that provides the standalone asciidoctorj command including Java components, launch scripts and required libraries.

asciidoctorj-arquillian-extension

Bundles an Arquillian extension that allows to inject an Asciidoctor instance or other instances commonly used by Asciidoctor tests into a test case.

asciidoctorj-test-support

Contains some common test classes that are used by multiple other subprojects and the Arquillian extension.

The Gradle build is partitioned into the following files:

build.gradle
gradle.properties
settings.gradle
gradle/
  wrapper/
    ...
  eclipse.gradle
  providedConfiguration.gradle
  publish.gradle
  sign.gradle
asciidoctorj-arquillian-extension/
  build.gradle
asciidoctorj-api/
  build.gradle
asciidoctorj-cli/
  build.gradle
asciidoctorj-core/
  build.gradle
asciidoctorj-distribution/
  build.gradle
asciidoctorj-test-support/
  build.gradle

Build the project

You invoke Gradle on this project using the gradlew command (i.e., the Gradle Wrapper).

💡
We strongly recommend that you use Gradle via the Gradle daemon.

To clone the project, compile the source and build the artifacts (i.e., jars) locally, run:

$ git clone https://github.com/asciidoctor/asciidoctorj
  cd asciidoctorj
  ./gradlew assemble

You can find the built artifacts in the asciidoctorj-*/build/libs folders.

To execute tests when running the build, use:

$ ./gradlew build

To only execute the tests, run:

$ ./gradlew check

You can also run tests for a single module:

$ cd asciidoctorj-core
  ../gradlew check

To run a single test in the asciidoctorj-core subproject, use:

$ ../gradlew -Dsingle.test=NameOfTestClass test

To create the distribution, run:

$ ./gradlew distZip

You can find the distribution in the asciidoctorj-distribution/build/distributions folder.

Develop in an IDE

IntelliJ IDEA

To import the project into IntelliJ IDEA 14, simply import the project using the import wizard. For more information, see the Gradle page in the IntelliJ IDEA Web Help.

Eclipse

To open the project in Eclipse, first generate the Eclipse project files:

$ cd asciidoctorj-core
  ./gradlew eclipse

Then, import the project into Eclipse using File  Import  General  Existing Project into Workspace.

Continuous integration

Continuous integration for the AsciidoctorJ project is performed by GitHub Actions. You can find recent build results, including the build status of pull requests, on the asciidoctor/asciidoctorj page.

Release and publish the artifacts

To build and publish a release the following properties have to be set, for example in the file ~/.gradle/gradle.properties:

~/.gradle/gradle.properties
signing.keyId=...              # (1)
signing.password=...
signing.secretKeyRingFile=/home/YOUR_USERNAME/.gnupg/secring.gpg

sdkman_consumer_key=...        # (2)
sdkman_consumer_token=...

sonatypeUsername=...           # (3)
sonatypePassword=...
  1. Settings for signing the artifacts

  2. Credentials for publishing a new release to sdkman

  3. Credentials for publishing artifacts to oss.sonatype.org

The following steps are necessary to build a new release:

  1. Update the version in gradle.properties to a release version, i.e. from 2.4.4-SNAPSHOT to 2.4.4.

  2. Build the release with

    # ./gradlew clean build
  3. After testing publish all artifacts to a local repository under build/repos with

    # ./gradlew publishAllPublicationsToLocalRepository -i
  4. When everything is fine publish the artifacts to a staging repository on https://oss.sonatype.org and close the repository:

    # ./gradlew publishAllPublicationsToSonatypeRepository -i
    # ./gradlew closeRepository -i
  5. Visit https://oss.sonatype.org/#stagingRepositories and check the staging repository. The artifacts are not published yet. The repository URL shown there can be used for testing this version before publishing to Maven central.

  6. When everything is fine publish the artifacts in the staging repository by clicking the "Release" button. Alternatively you can release it with

    # ./gradlew releaseRepository
  7. Publish the new version to sdkman with

    # ./gradlew asciidoctorj-distribution:sdkMajorRelease
  8. Commit everything and assign a tag:

    # git commit -m "Release v2.x.y"
    # git tag v2.x.y
  9. Upgrade the version to the next version by changing the version property in gradle.properties to version=2.x.y+1-SNAPSHOT and commit:

    git commit -m "Prepare next release"

Resources

The source code for AsciidoctorJ, including the latest developments and issues, can be found in the project’s repository on GitHub. If you identify an issue while using AsciidoctorJ, please don’t hesitate to file a bug report. Also, don’t forget to join the Asciidoctor Zulip community, where you can ask questions and leave comments.

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

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
5

asciidoctor-intellij-plugin

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

asciidoctor.org

🌐 Asciidoctor project site. Composed in AsciiDoc. Baked with Awestruct.
SCSS
308
star
7

asciidoctor-maven-plugin

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

jekyll-asciidoc

💉 A Jekyll plugin that converts AsciiDoc source files in your site to HTML pages using Asciidoctor.
Ruby
298
star
9

docker-asciidoctor

🚢 A Docker image for using the Asciidoctor toolchain to process AsciiDoc content
Shell
294
star
10

asciidoctor-vscode

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

asciidoctor-gradle-plugin

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

asciidoctor-reveal.js

🔮 A reveal.js converter for Asciidoctor and Asciidoctor.js. Write your slides in AsciiDoc!
HTML
270
star
13

asciidoctor-epub3

📘 Asciidoctor EPUB3 is a set of Asciidoctor extensions for converting AsciiDoc to EPUB3 & KF8/MOBI
Ruby
203
star
14

asciidoctor-browser-extension

⚪ An extension for web browsers that converts AsciiDoc files to HTML using Asciidoctor.js.
CSS
202
star
15

asciidoctor-maven-examples

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

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
17

kramdown-asciidoc

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

asciidoctor-gradle-examples

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

atom-asciidoc-preview

⚛ AsciiDoc preview for the Atom editor.
CoffeeScript
142
star
20

asciidoctor-kroki

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

asciidoclet

📋 A Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax.
Java
120
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