28-mar-2016: Welcome to our new server! Faster and less prone to crashing.

Welcome to the Slackware Documentation Project

asciidoc Mini HOWTO


Keeping notes is an integral part of using any Linux distribution. Keeping them in plain text allows one to use them from a console during initial setup; using a consistent markup for plain text adds to the readability of the notes.

asciidoc is one of the tools that provide such a consistent markup. Source highlighting, for those who prefer it, can add to the readability of the text file.

asciidoc can produce HTML files, an added bonus as it allows to interlink notes and makes browsing them with lynx more effective. It can also work in tandem with man2html to provide HTML access to all installed man pages on the fly.

For an interesting read about asciidoc see Living the Future of Technical Writing.

Helper Packages and Files


Consider installing Asciidoctor.


To convert asciidoc files to PDF, install dblatex from SlackBuilds.org. See documentation, PDF.


To highlight source listings, install source-highlight from SlackBuilds.org. See online manual. This:

export LANG=en_US.UTF-8

renders as (this is DokuWiki's GeSHi highlighting, but gives the general idea):

export LANG=en_US.UTF-8

Vim Syntax Highlighter

If asciidoc.vim is not available locally, download. Otherwise:

$ mkdir -p $HOME/.vim/syntax

$ cp /usr/share/vim/vimVERSION/syntax/asciidoc.vim $HOME/.vim/syntax/

and see Appendix E. Vim Syntax Highlighter.

Highlighting can also work by inserting at the bottom of the file:

// vim: set syntax=asciidoc:

User Guide

The user guide file is found in /usr/doc/asciidoc-VERSION/doc/asciidoc.txt. To make the AsciiDoc User Guide:

$ asciidoc -b xhtml11 -a icons -a iconsdir=/etc/asciidoc/images/icons FILENAME

and see /usr/doc/asciidoc-VERSION/doc/asciidoc.html. For more see asciidoc.org.

Source Files


It is a convention for asciidoc files to have a .txt extension.

Common Variables

To organize the use of common variables in all files, make a directory include. Common paths, for example, can be put in a paths.txt as a series of:

:pathname: {pathname=/path/to/somewhere}

Then, at the header of each file put:


and in text use as:


System Attributes

Any variable that can be defined in bash with NAME=“$(commands)” can also be defined in asciidoc as a system attribute. First define the attribute in the header section:

:NAME: {sys:commands}

then use in text as:



Linking to man pages in HTML is very useful. See man2html Mini HOWTO on how to set the infrastructure. To see grep(1) use




To make an HTML file:

$ asciidoc -b xhtml11 FILENAME

To use icons, mainly for admonition paragraphs, add the options:

-a icons -a iconsdir=/etc/asciidoc/images/icons

To have a fixed-width HTML, add:

-a max-width=45em

To use additional custom CSS, add:

-a stylesheet=/path/to/stylesheet.css

It may be helpful to put an alias in .bashrc:

alias ad="/usr/bin/asciidoc.py \
  -b xhtml11 \
  -a icons -a max-width=45em \
  -a iconsdir=/etc/asciidoc/images/icons \
  -a stylesdir=/etc/asciidoc/stylesheets \
  -a stylesheet=/path/to/stylesheet.css"


To make a PDF file, first install dblatex. Then:

$ asciidoc -b docbook45 FILENAME

$ dblatex FILENAME.xml


The asciidoc files can be converted to DokuWiki format for the Slackware Documentation Project. There are various ways to do this, and one of the more straightforward ones is to convert the HTML files produced by asciidoc using the perl module HTML::WikiConverter::DokuWiki, see also HTML::WikiConverter.

# cpan

cpan[1]> install HTML::WikiConverter::DokuWiki

$ html2wiki –dialect DokuWiki input.html > output.wiki


  • Originally written by pdi

In Other Languages
Translations of this page?:
QR Code
QR Code howtos:software:asciidoc_mini_howto (generated for current page)