asciidoctor (evacuated from NSA/Microsoft Github)
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Dan Allen d15bc65a94 remove unnecessary optimization in restore_passthroughs 6 years ago
benchmark unset stylesheet instead of setting linkcss in benchmark 7 years ago
bin optimize bin scripts 8 years ago
compat cleanup intrinsic attribute list 9 years ago
data follow-up to #2624; don't add lead style to first paragraph inside table if role is specified 6 years ago
features resolves #2365 allow xrefstyle to be overridden per xref using the xrefstyle attribute (PR #2706) 6 years ago
lib remove unnecessary optimization in restore_passthroughs 6 years ago
man provide more accurate description for -s CLI option 6 years ago
test resolves #2792 fix formatting of quote block in manpage output (PR #2793) 6 years ago
.gitignore enable CI reports 9 years ago
.simplecov enable CI reports 9 years ago
.travis.yml Fix travis error (ruby-2.5.0, failed to uninstall bundler) (PR #2548) 6 years ago
.yardopts move yard deps to Gemfile and remove rake task 6 years ago
CHANGELOG.adoc resolves #2792 fix formatting of quote block in manpage output (PR #2793) 6 years ago
CONTRIBUTING.adoc move yard deps to Gemfile and remove rake task 6 years ago
Gemfile move yard deps to Gemfile and remove rake task 6 years ago
Guardfile add Guardfile and deps for continuous testing 11 years ago
LICENSE update copyright year 🎊 6 years ago
README-fr.adoc Begin development on next version [skip ci] 6 years ago
README-jp.adoc Begin development on next version [skip ci] 6 years ago
README-zh_CN.adoc Begin development on next version [skip ci] 6 years ago
README.adoc remove mention of Mint from README 6 years ago
Rakefile drop obsolete build logic 6 years ago
appveyor.yml don't attempt to install Bundler on AppVeyor (PR #2492) 6 years ago
asciidoctor.gemspec Load asciidoctor/version from LOAD_PATH if not found locally (PR #2760) 6 years ago configure script to run all tests 7 years ago
screenshot.png README revisions 10 years ago


= Asciidoctor
Dan Allen <[@mojavelinux]>; Sarah White <[@graphitefriction]>; Ryan Waldron <[@erebor]>
// settings:
:idseparator: -
:source-language: ruby
:language: {source-language}
ifndef::env-github[:icons: font]
:outfilesuffix: .adoc
:caution-caption: :fire:
:important-caption: :exclamation:
:note-caption: :paperclip:
:tip-caption: :bulb:
:warning-caption: :warning:
// Variables:
:release-version: 1.5.7
// URIs:
:uri-repo: {uri-org}/asciidoctor
:uri-asciidoctorj: {uri-org}/asciidoctorj
:uri-asciidoctorjs: {uri-org}/asciidoctor.js
ifdef::env-site[:uri-project: link:]
:uri-docs: {uri-project}/docs
:uri-news: {uri-project}/news
:uri-manpage: {uri-project}/man/asciidoctor
:uri-issues: {uri-repo}/issues
:uri-contributors: {uri-repo}/graphs/contributors
:uri-rel-file-base: link:
:uri-rel-tree-base: link:
:uri-rel-file-base: {uri-repo}/blob/master/
:uri-rel-tree-base: {uri-repo}/tree/master/
:uri-changelog: {uri-rel-file-base}CHANGELOG.adoc
:uri-contribute: {uri-rel-file-base}CONTRIBUTING.adoc
:uri-license: {uri-rel-file-base}LICENSE
:uri-tests: {uri-rel-tree-base}test
:uri-irc: irc://
:uri-what-is-asciidoc: {uri-docs}/what-is-asciidoc
:uri-user-manual: {uri-docs}/user-manual
//:uri-install-doc: {uri-docs}/install-toolchain
:uri-install-macos-doc: {uri-docs}/install-asciidoctor-macos
:uri-render-doc: {uri-docs}/render-documents
:uri-themes-doc: {uri-docs}/produce-custom-themes-using-asciidoctor-stylesheet-factory
:uri-prototype: {uri-gitscm-repo}/commits/master/lib/asciidoc.rb
// images:

{uri-project}[Asciidoctor] is a _fast_ text processor and publishing toolchain for converting {uri-what-is-asciidoc}[AsciiDoc] content to HTML5, DocBook, PDF, and other formats.
Asciidoctor is written in Ruby, packaged and distributed as a gem to {uri-rubygem}[], and packaged for popular Linux distributions, including Fedora, Debian, Ubuntu, and Alpine.
Asciidoctor can be run on the JVM using AsciidoctorJ and in all JavaScript environments using Asciidoctor.js.
Asciidoctor is {uri-license}[open source software] and {uri-repo}[hosted on GitHub].

This document is also available in the following languages: +

.Key documentation
* {uri-docs}/what-is-asciidoc[What is AsciiDoc?]
* {uri-docs}/asciidoc-writers-guide[AsciiDoc Writer's Guide]
* {uri-docs}/user-manual[Asciidoctor User Manual]
* {uri-docs}/asciidoc-syntax-quick-reference[AsciiDoc Syntax Reference]

.*Project health*
image:[Build Status (Travis CI), link=]
image:;passingText=green%20bar&amp;failingText=%23fail&amp;pendingText=building%2E%2E%2E[Build Status (AppVeyor), link=]
//image:[Coverage Status, link=]
//image:[Code Climate, link=""]
image:[Inline docs, link=""]

== Sponsors

We want to recognize our generous sponsors, without whose support Asciidoctor would not be possible.
Thank you sponsors for your dedication to improving the state of technical documentation!

image:[Okta,280,link=,title="Add User Auth to Your Apps in Minutes with Okta"]
&nbsp; &nbsp; &nbsp;
image:[OpenDevise,100,link=,title="Let the Creators of Asciidoctor and Antora Help You to Accelerate Your Docs"]

Major funding for Asciidoctor is provided by our *Change Makers*,[Okta] and[OpenDevise], and our *Strategy Sponsors*, Khronos Group and Linda Roberts.
Additional funding is provided by our[Community Backers].

You can support this project by becoming a sponsor on[OpenCollective].

== The Big Picture

Asciidoctor reads content written in plain text, as shown in the panel on the left in the image below, and converts it to HTML5, as shown rendered in the right panel.
Asciidoctor applies a default stylesheet to the HTML5 document to provide a pleasant out-of-the-box experience.

image::{image-uri-screenshot}[Preview of AsciiDoc source and corresponding rendered HTML]

== AsciiDoc Processing

Asciidoctor reads and parses text written in the AsciiDoc syntax, then feeds the parse tree to a set of built-in converters to produce HTML5, DocBook 5 (or 4.5) or man(ual) page output.
You have the option of using your own converter or loading {uri-tilt}[Tilt]-supported templates to customize the generated output or produce additional formats.

NOTE: Asciidoctor is a drop-in replacement for the original AsciiDoc Python processor (``).
The Asciidoctor test suite has {uri-tests}[> 2,000 tests] to ensure compatibility with the AsciiDoc syntax.

In addition to the classic AsciiDoc syntax, Asciidoctor recognizes additional markup and formatting options, such as font-based icons (e.g., `+icon:fire[]+`) and UI elements (e.g., `+button:[Save]+`).
Asciidoctor also offers a modern, responsive theme based on {uri-foundation}[Foundation] to style the HTML5 output.

== Where Ruby goes, Asciidoctor follows

You can run Asciidoctor on the JVM using JRuby.
To invoke the Asciidoctor API directly from Java and other JVM languages, use {uri-asciidoctorj}[AsciidoctorJ].
There are plugins available, based on AsciidoctorJ, that integrate the Asciidoctor processor into Apache Maven, Gradle or Javadoc builds.

Asciidoctor also runs in JavaScript.
We use[Opal] to transcompile the Ruby source to JavaScript to produce {uri-asciidoctorjs}[Asciidoctor.js], a fully-functional version of Asciidoctor that works in any JavaScript environment, such as a web browser or Node.js.
Asciidoctor.js is used to power the AsciiDoc preview extensions for Chrome, Atom, Brackets and other web-based tooling.

== Requirements

Asciidoctor works on Linux, macOS and Windows and requires one of the following implementations of {uri-ruby}[Ruby]:

* Ruby (MRI/CRuby 1.8.7 - 2.5)
* JRuby (1.7 in Ruby 1.8 and 1.9 modes, 9000)
* Rubinius 2.2.x
* Opal (JavaScript)

We welcome your help testing Asciidoctor on these and other platforms.
Refer to the <<Contributing>> section to learn how to get involved.

If you're using a non-English Windows environment, you may bump into an `Encoding::UndefinedConversionError` when invoking Asciidoctor.
To solve this issue, we recommend changing the active code page in your console to UTF-8:

 chcp 65001

Once you make this change, all your Unicode headaches will be behind you.
If you're using an IDE like Eclipse, make sure you set the encoding to UTF-8 there as well.
Asciidoctor works best when you use UTF-8 everywhere.

== Installation

Asciidoctor can be installed using (a) the `gem install` command, (b) Bundler, (c) package managers for popular Linux distributions, or (d) Homebrew for macOS.

TIP: The benefit of using a Linux package manager to install the gem is that it handles installing Ruby and the RubyGems library if those packages are not already installed on your machine.
The drawback is that the package may not be available immediately after the release of the gem.
If you need the latest version, you can always fallback to using the `gem` command.

=== (a) gem install

Open a terminal and type (excluding the leading `$`):

 $ gem install asciidoctor

If you want to install a pre-release version (e.g., a release candidate), use:

 $ gem install asciidoctor --pre

.Upgrading your installation
If you have an earlier version of Asciidoctor installed, you can update it using:

 $ gem update asciidoctor

If you install a new version of the gem using `gem install` instead of gem update, you'll have multiple versions installed.
If that's the case, use the following gem command to remove the old versions:

 $ gem cleanup asciidoctor

=== (b) Bundler

. Create a Gemfile in the root folder of your project (or the current directory)
. Add the `asciidoctor` gem to your Gemfile as follows:
source ''
gem 'asciidoctor'
# or specify the version explicitly
# gem 'asciidoctor', '{release-version}'

. Save the Gemfile
. Open a terminal and install the gem using:

 $ bundle

To upgrade the gem, specify the new version in the Gemfile and run `bundle` again.
Using `bundle update` is *not* recommended as it will also update other gems, which may not be the desired result.

=== (c) Linux package managers

==== DNF (Fedora 21 or greater)

To install the gem on Fedora 21 or greater using dnf, open a terminal and type:

 $ sudo dnf install -y asciidoctor

To upgrade the gem, use:

 $ sudo dnf update -y asciidoctor

TIP: Your system may be configured to automatically update rpm packages, in which case no action is required by you to update the gem.

==== apt-get (Debian or Ubuntu)

To install the gem on Debian or Ubuntu, open a terminal and type:

 $ sudo apt-get install -y asciidoctor

To upgrade the gem, use:

 $ sudo apt-get upgrade -y asciidoctor

TIP: Your system may be configured to automatically update deb packages, in which case no action is required by you to update the gem.

The version of Asciidoctor installed by the package manager (apt-get) may not match the latest release of Asciidoctor.
Consult the package repository for your distribution to find out which version is packaged per distribution release.

*[asciidoctor package by Debian release]
*[asciidoctor package by Ubuntu release]

You're advised against using the `gem update` command to update a gem managed by the package manager.
Doing so puts the system into an inconsistent state as the package manager can no longer track the files (which get installed under /usr/local).
Simply put, system gems should only be managed by the package manager.

If you want to use a version of Asciidoctor that is newer than what is installed by the package manager, you should use[RVM] to install Ruby in your home directory (i.e., user space).
Then, you can safely use the `gem` command to install or update the Asciidoctor gem.
When using RVM, gems are installed in a location isolated from the system.

==== apk (Alpine Linux)

To install the gem on Alpine Linux, open a terminal and type:

 $ sudo apk add asciidoctor

To upgrade the gem, use:

 $ sudo apk add -u asciidoctor

TIP: Your system may be configured to automatically update apk packages, in which case no action is required by you to update the gem.

=== (d) Homebrew (macOS)

You can use Homebrew to install Asciidoctor on macOS.
If you haven't yet installed Homebrew, follow the instructions at[].

Once Homebrew is installed, you can install the `asciidoctor` gem using the[asciidoctor] package.
To do so, open a terminal and type:

 $ brew install asciidoctor

To upgrade the gem, use:

 $ brew update
 $ brew upgrade asciidoctor

TIP: Homebrew installs the `asciidoctor` gem into an exclusive prefix that's independent of system gems.

=== Other installation options

* {uri-install-docker}[Installing Asciidoctor using Docker]
* {uri-install-macos-doc}[Installing Asciidoctor on macOS]
// at the moment, the following entry is just a reiteration of the information in this README
//* {uri-install-doc}[Installing the Asciidoctor toolchain]

== Usage

If the Asciidoctor gem installed successfully, the `asciidoctor` command line interface (CLI) will be available on your PATH.
To verify it's available, run the following in your terminal:

 $ asciidoctor --version

You should see information about the Asciidoctor version and your Ruby environment printed in the terminal.

Asciidoctor {release-version} []
Runtime Environment (ruby 2.4.1p111 [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)

Asciidoctor also provides an API.
The API is intended for integration with other Ruby software, such as Rails, Sinatra and GitHub, and other languages, such as Java (via {uri-asciidoctorj}[AsciidoctorJ]) and JavaScript (via {uri-asciidoctorjs}[Asciidoctor.js]).

=== Command line interface (CLI)

The `asciidoctor` command allows you to invoke Asciidoctor from the command line (i.e., a terminal).

The following command converts the file README.adoc to HTML and saves the result to the file README.html in the same directory.
The name of the generated HTML file is derived from the source file by changing its file extension to `.html`.

 $ asciidoctor README.adoc

You can control the Asciidoctor processor by adding various flags and switches, which you can learn about using:

 $ asciidoctor --help

For instance, to write the file to a different directory, use:

 $ asciidoctor -D output README.adoc

The `asciidoctor` {uri-manpage}[man page] provides a complete reference of the command line interface.

Refer to the following resources to learn more about how to use the `asciidoctor` command.

* {uri-render-doc}[How do I convert a document?]
* {uri-themes-doc}[How do I use the Asciidoctor stylesheet factory to produce custom themes?]

=== Ruby API

To use Asciidoctor in your application, you first need to require the gem:

require 'asciidoctor'

You can then convert an AsciiDoc source file to an HTML file using:

Asciidoctor.convert_file 'README.adoc', to_file: true, safe: :safe

WARNING: When using Asciidoctor via the API, the default safe mode is `:secure`.
In secure mode, several core features are disabled, including the `include` directive.
If you want to enable these features, you'll need to explicitly set the safe mode to `:server` (recommended) or `:safe`.

You can also convert an AsciiDoc string to embeddable HTML (for inserting in an HTML page) using:

content = '_Zen_ in the art of writing[AsciiDoc].'
Asciidoctor.convert content, safe: :safe

If you want the full HTML document, enable the `header_footer` option as follows:

content = '_Zen_ in the art of writing[AsciiDoc].'
html = Asciidoctor.convert content, header_footer: true, safe: :safe

If you need access to the parsed document, you can split the conversion into discrete steps:

content = '_Zen_ in the art of writing[AsciiDoc].'
document = Asciidoctor.load content, header_footer: true, safe: :safe
puts document.doctitle
html = document.convert

Keep in mind that if you don't like the output Asciidoctor produces, _you can change it!_
Asciidoctor supports custom converters that can handle converting from the parsed document to the generated output.

One easy way to customize the output piecemeal is by using the template converter.
The template converter allows you to supply a {uri-tilt}[Tilt]-supported template file to handle converting any node in the document.

However you go about it, you _can_ have 100% control over the output.
For more information about how to use the API or to customize the output, refer to the {uri-user-manual}[user manual].

== Contributing

In the spirit of {uri-freesoftware}[free software], _everyone_ is encouraged to help improve this project.
If you discover errors or omissions in the source code, documentation, or website content, please don't hesitate to submit an issue or open a pull request with a fix.
New contributors are always welcome!

Here are some ways *you* can contribute:

* by using prerelease (alpha, beta or preview) versions
* by reporting bugs
* by suggesting new features
* by writing or editing documentation
* by writing specifications
* by writing code -- _No patch is too small._
** fix typos
** add comments
** clean up inconsistent whitespace
** write tests!
* by refactoring code
* by fixing {uri-issues}[issues]
* by reviewing patches

The {uri-contribute}[Contributing] guide provides information on how to create, style, and submit issues, feature requests, code, and documentation to the Asciidoctor Project.

== Getting Help

The Asciidoctor project is developed to help you easily write and publish your content.
But we can't do it without your feedback!
We encourage you to ask questions and discuss any aspects of the project on the discussion list, on Twitter or in the chat room.

Discussion list (Nabble):: {uri-discuss}
Twitter::[#asciidoctor] hashtag or[@asciidoctor] mention
Chat (Gitter):: image:[Gitter, link=]
Chat (IRC):: {uri-irc}[#asciidoctor] on FreeNode IRC

Further information and documentation about Asciidoctor can be found on the project's website.

{uri-project}[Home] | {uri-news}[News] | {uri-docs}[Docs]

The Asciidoctor organization on GitHub hosts the project's source code, issue tracker, and sub-projects.

Source repository (git):: {uri-repo}
Issue tracker:: {uri-issues}
Asciidoctor organization on GitHub:: {uri-org}

== Copyright and Licensing

Copyright (C) 2012-2018 Dan Allen, Ryan Waldron and the Asciidoctor Project.
Free use of this software is granted under the terms of the MIT License.

See the {uri-license}[LICENSE] file for details.

== Authors

*Asciidoctor* is led by[Dan Allen] and[Sarah White] and has received contributions from {uri-contributors}[many other individuals] in Asciidoctor's awesome community.
The project was initiated in 2012 by[Ryan Waldron] and based on {uri-prototype}[a prototype] written by[Nick Hengeveld].

*AsciiDoc* was started by Stuart Rackham and has received contributions from many other individuals in the AsciiDoc community.

== Changelog

ifeval::[{safe-mode-level} < 20]

Refer to the {uri-changelog}[CHANGELOG] for a complete list of changes in older releases.