Asciidoctor Documentation

This is the documentation for the Ruby-based AsciiDoc processor named Asciidoctor. Asciidoctor currently serves as the reference implementation for how to interpret the AsciiDoc language. If you’re looking for the documentation for the AsciiDoc language, see the AsciiDoc section of this website.

What is Asciidoctor?

Asciidoctor is a fast, open source, text processor for parsing AsciiDoc into a document model, then converting it to output formats such as HTML 5, DocBook 5, man(ual) pages, PDF, and EPUB 3. Asciidoctor is written in the Ruby programming language.

When we use the name “Asciidoctor” in this area of the documentation, we’re referring to the core Asciidoctor Ruby processor, abbreviated as Asciidoctor core or Asciidoctor Ruby. We add the qualifier “core” because Asciidoctor is also the name of the suite of projects that provides runtimes, extensions, and tools for processing AsciiDoc.

To simplify installation, Asciidoctor is packaged as a gem named asciidoctor and published to the gem hosting service located at RubyGems.org. A gem is a packaged Ruby application or library (in this case, both). The asciidoctor gem can be installed directly from RubyGems.org on all major operating systems using Ruby packaging tools (gem or bundle). Asciidoctor is also distributed as a Docker image, as a package for numerous Linux distributions, and as a package for macOS (via Homebrew and MacPorts).

Asciidoctor is open source software available under the terms of the MIT license and hosted on GitHub.

Asciidoctor is the successor to AsciiDoc.py, the legacy Python-based processor for the AsciiDoc language. If you’re using AsciiDoc.py, follow Migrate from AsciiDoc.py to learn how to upgrade to Asciidoctor.

Basic usage

Asciidoctor provides two interfaces for processing AsciiDoc documents, a CLI named asciidoctor and a Ruby API named Asciidoctor. The following table gives you an idea of how to use these interfaces.

CLI API
$ asciidoctor document.adoc
require 'asciidoctor'
Asciidoctor.convert_file \
  'document.adoc', safe: :safe

See Process AsciiDoc Using the CLI to learn more about this interface.

See Process AsciiDoc Using the API to learn more about this interface.

Relationship to AsciiDoc

AsciiDoc is the language.
Asciidoctor is the processor.

You compose documents using the AsciiDoc language, which is a text-based writing format. The AsciiDoc language was designed to be unobtrusive and concise to simplify writing and make it more pleasant. But AsciiDoc itself is not a publishing format. It’s more like a shorthand. That’s where an AsciiDoc processor comes in.

An AsciiDoc processor, such as Asciidoctor, reads the AsciiDoc source and converts it to publishable formats such as HTML 5 or PDF. It can also convert it to formats which themselves can be processed by a publishing toolchain, such as DocBook.

Since AsciiDoc is not published as is, the processing step provides an opportunity to augment the document by expanding shorthand codes, layering in integrations, and applying a pleasant visual style. That augmentation is a large part of what Asciidoctor does.

In brief, you give AsciiDoc source to Asciidoctor and it gives you a result you can publish.

Ecosystem

When we talk about Asciidoctor in this section, we are talking about the core processor and built-in converters. Asciidoctor also has an ecosystem of extensions, converters, build plugins, and tools to help you author and publish content written in AsciiDoc. You can find the documentation for these projects elsewhere on this site or in the Asciidoctor organization on GitHub.

Beyond Ruby

Although Asciidoctor is written in Ruby, it does not mean you need Ruby to use it. You can also run Asciidoctor using a JVM via AsciidoctorJ or JavaScript via Asciidoctor.js.

Java / JVM

Thanks to AsciidoctorJ, Asciidoctor can be used in any program that runs on a Java Virtual Machine (JVM). Under the covers, AsciidoctorJ uses JRuby to run Asciidoctor, but this is hidden behind a Java API. AsciidoctorJ even provides an alternate CLI, which means you can get the full Asciidoctor experience with only a Java runtime. Building atop AsciidoctorJ, there are also plugins that integrate Asciidoctor into Apache Maven, Gradle, or Javadoc builds.

JavaScript

Thanks to Asciidoctor.js, Asciidoctor can also be used in JavaScript. The Asciidoctor.js project uses Opal to transpile the Ruby source in Asciidoctor to JavaScript. The result is a fully-functional version of Asciidoctor that works on any JavaScript runtime, such as a modern browser or Node.js. Asciidoctor.js even provides an alternate CLI, which means you can get the full Asciidoctor experience with only a JavaScript runtime. Asciidoctor.js is used to power the AsciiDoc language preview extensions for Chrome, Atom, Brackets, and other web-based tooling.

To be accurate, you can run Asciidoctor using Ruby, a JVM, or JavaScript. This documentation focuses on the Ruby version of Asciidoctor.