POWERMAN
"In each of us sleeps a genius...
and his sleep gets deeper everyday."

Abstract

This is a cheatsheet for AsciiDoc - “Text based document generation” script. The cheatsheet available for different AsciiDoc versions (because of some markup syntax changes) and using different css styles. Here is list with all available cheatsheets for different AsciiDoc version and using different css styles.

This cheatsheet is for AsciiDoc 8.2.7, using default css.

Document header (REQUIRED)

Main Header
===========
Optional Author Name <optional@author.email>
Optional version, optional date
:Author:    AlternativeWayToSetOptional Author Name
:Email:     <AlternativeWayToSetOptional@author.email>
:Date:      AlternativeWayToSetOptional date
:Revision:  AlternativeWayToSetOptional version

Attributes

There a lot of predefined attributes in AsciiDoc, plus you can add your own. To get attribute value use {attributename} syntax.

Author is {author}

Author is Alex Efros

Version is {revision}

Version is 2.1.1

Line
with bad attribute {qwe} will be
deleted

Line deleted

:My variable:  my value
My is {myvariable}

My is my value

Escaped: \{qwe} and +++{qwe}+++

Escaped: {qwe} and {qwe}

Headers

Level 1
-------
Level 2
~~~~~~~
Level 3
^^^^^^^
Level 4
+++++++

Level 1

Level 2

Level 3

Level 4
== Level 1
=== Level 2
==== Level 3
===== Level 4

Level 1

Level 2

Level 3

Level 4

Paragraphs

.Optional Title

Usual
paragraph.
Optional Title

Usual paragraph.

.Optional Title

 Literal paragraph.
  Must be indented.
Optional Title
Literal paragraph.
 Must be indented.
.Optional Title

[source,perl]
die "connect: $dbh->errstr";
Optional Title
die "connect: $dbh->errstr";
.Optional Title
NOTE: This is an example
      single-paragraph note.
Note
Optional Title
This is an example single-paragraph note.
.Optional Title
[NOTE]
This is an example
single-paragraph note.
Note
Optional Title
This is an example single-paragraph note.
TIP: Tip.
Tip Tip.
IMPORTANT: Important.
Important Important.
WARNING: Warning.
Warning Warning.
CAUTION: Caution.
Caution Caution.

Blocks

.Optional Title
----
*Listing* Block

Use: code or file listings
----
Optional Title
*Listing* Block

Use: code or file listings
.Optional Title
[source,perl]
----
# *Source* block
# Use: highlight code listings
# (require `source-highlight`)
use DBI;
my $dbh = DBI->connect('...',$u,$p)
    or die "connect: $dbh->errstr";
----
Optional Title
# *Source* block
# Use: highlight code listings
# (require `source-highlight`)
use DBI;
my $dbh = DBI->connect('...',$u,$p)
    or die "connect: $dbh->errstr";
.Optional Title
****
*Sidebar* Block

Use: sidebar notes :)
****
Optional Title

Sidebar Block

Use: sidebar notes :)

.Optional Title
==========================
*Example* Block

Use: examples :)

Default caption "Example:"
can be changed using

 [caption="Custom: "]

before example block.
==========================
Example 1. Optional Title

Example Block

Use: examples :)

Default caption "Example:" can be changed using

[caption="Custom: "]

before example block.

.Optional Title
[NOTE]
===============================
*NOTE* Block

Use: multi-paragraph notes.
===============================
Note
Optional Title

NOTE Block

Use: multi-paragraph notes.

////
*Comment* block

Use: hide comments
////
++++
*Passthrough* Block
<p>
Use: backend-specific markup like
<table border="1">
<tr><td>1<td>2
</table>
++++
*Passthrough* Block

Use: backend-specific markup like

12
 .Optional Title
 ....
 *Literal* Block

 Use: workaround when literal
 paragraph (indented) like
   1. First.
   2. Second.
 incorrectly processed as list.
 ....
Optional Title
*Literal* Block

Use: workaround when literal
paragraph (indented) like
  1. First.
  2. Second.
incorrectly processed as list.
.Optional Title
[quote, cite author, cite source]
____
*Quote* Block

Use: cite somebody
____
Optional Title

Quote Block

Use: cite somebody

cite source
— cite author

Text

forced +
line break

forced
line break

normal, _italic_, *bold*, +mono+.

``quoted'', ^super^, ~sub~.

normal, italic, bold, mono.

“quoted”, super, sub.

Command: `ls -al`

Command: ls -al

Path: '/some/filez.txt', '.b'

Path: /some/filez.txt, .b

[red]#red text# [,yellow]#on yellow#
[,,2]#large# [red,yellow,2]*all bold*

red text on yellow large all bold

Chars: n__i__**b**++m++[red]##r##

Chars: nibmr

// Comment
(C) (R) (TM) -- ...

© ® ™ — …

''''

Escaped:
\_italic_, +++_italic_+++,
t\__e__st, +++t__e__st+++,
+++<b>bold</b>+++, $$<b>normal</b>$$

Escaped: _italic_, _italic_, t__e__st, t__e__st, bold, <b>normal</b>

If you’ll need to use space in url/path you should replace it with %20.

[[anchor-1]]
Paragraph or block 1.

anchor:anchor-2[]
Paragraph or block 2.

<<anchor-1>>,
<<anchor-1,First anchor>>,
xref:anchor-2[],
xref:anchor-2[Second anchor].

Paragraph or block 1.

Paragraph or block 2.

link:asciidoc[This document]
link:asciidoc.html[]
link:/index.html[This site root]
http://google.com
http://google.com[Google Search]
mailto:root@localhost[email admin]
First home
image:images/icons/home.png[]
, second home
image:images/icons/home.png[Alt text]
.

.Block image
image::images/icons/home.png[]
image::images/icons/home.png[Alt text]

.Thumbnail linked to full image
image:/images/font/640-screen2.gif[
"My screenshot",width=128,
link="/images/font/640-screen2.gif"]

First home images/icons/home.png , second home Alt text .

images/icons/home.png
Figure 1. Block image
Alt text
Thumbnail linked to full image

My screenshot

This is example how files
can be included.
It's commented because
there no such files. :)

// include::footer.txt[]

// [perl]
// source~~~~
// include::script.pl[]
// source~~~~

This is example how files can be included. It’s commented because there no such files. :)

Lists

.Bulleted
* bullet
* bullet
  - bullet
  - bullet
* bullet
Bulleted
  • bullet

  • bullet

    • bullet

    • bullet

  • bullet

.Bulleted 2
- bullet
  * bullet
Bulleted 2
  • bullet

    • bullet

.Ordered
. number
. number
  .. letter
  .. letter
. number
Ordered
  1. number

  2. number

    1. letter

    2. letter

  3. number

.Ordered 2
a. letter
.. letter
   .  number
   2. number
c. letter
Ordered 2
  1. letter

    1. letter

      1. number

        1. number

  2. letter

.Labeled
Term 1::
    Definition 1
Term 2::
    Definition 2
    Term 2.1;;
        Definition 2.1
    Term 2.2;;
        Definition 2.2
Term 3::
    Definition 3
Labeled
Term 1

Definition 1

Term 2

Definition 2

Term 2.1

Definition 2.1

Term 2.2

Definition 2.2

Term 3

Definition 3

.Labeled 2
Term 1;;
    Definition 1
    Term 1.1::
        Definition .1.1
Labeled 2
Term 1

Definition 1

Term 1.1

Definition .1.1

.Labeled horizontal
Term 1:: Definition 1
Term 2:: \
    Definition 2
Labeled horizontal
Term 1

Definition 1

Term 2

\ Definition 2

.Q&A
Question 1??
    Answer 1
Question 2??
    Answer 2
Q&A
  1. Question 1

    Answer 1

  2. Question 2

    Answer 2

.Indent is optional
- bullet
    * another bullet
        1. number
        .  again number
            a. letter
            .. again letter

.. letter
. number

* bullet
- bullet
Indent is optional
  • bullet

    • another bullet

      1. number

        1. again number

          1. letter

            1. again letter

            2. letter

        2. number

    • bullet

  • bullet

.Break two lists
. number
. number

Independent paragraph break list.

. number

.Header break list too
. number

.List block define list boundary
--
. number
. number
--

--
. number
. number
--
Break two lists
  1. number

  2. number

Independent paragraph break list.

  1. number

Header break list too
  1. number

List block define list boundary
  1. number

  2. number

  1. number

  2. number

.Continuation
- bullet
continuation
. number
  continuation
* bullet

  literal continuation

.. letter
+
Non-literal continuation.
+
----
any block can be

included in list
----
+
Last continuation.
Continuation
  • bullet continuation

    1. number continuation

      • bullet

        literal continuation
        1. letter

          Non-literal continuation.

          any block can be
          
          included in list

          Last continuation.

.List block force continuation
--
- bullet
continuation

more continuation

and more

. number
  continuation

  literal continuation

more continuation

- last bullet

last continuation
--
List block force continuation
  • bullet continuation

more continuation

and more

  1. number continuation

    literal continuation

more continuation

  • last bullet

last continuation

.List block allow sublist inclusion
- bullet
  * bullet
+
--
    - bullet
      * bullet
--
  * bullet
- bullet
  . number
    .. letter
+
--
      . number
        .. letter
--
    .. letter
  . number
List block allow sublist inclusion
  • bullet

    • bullet

      • bullet

      • bullet

    • bullet

  • bullet

    1. number

      1. letter

        1. number

        1. letter

      2. letter

    2. number

Tables

You can fill table from CSV file using include:: macros inside table.

.An example table
[grid="all"]
`-------.-----------'----
Col 1   Col 2       Col 3
-------------------------
1       Item 1      a
2       Item 2      b
3       Item 3      c
-------------------------
6       Three items d
-------------------------
TableAn example table
Col 1 Col 2 Col 3
6 Three items d
1 Item 1 a
2 Item 2 b
3 Item 3 c
.CSV data, 15% each column
````~15
1,2,3,4
a,b,c,d
A,B,C,D
~~~~~~~~
TableCSV data, 15% each column
1 2 3 4
a b c d
A B C D
[grid="rows"]
.15`20`25`20'~~~~~~~~~~~~~~~~~~
ID,FName,LName,Address,Phone
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1,Vasya,Pupkin,London,+123
2,X,Y,"A,B",45678
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Table15`20`25`20'~~~~~~~~~~~~~~~~~~
ID FName LName Address Phone
1 Vasya Pupkin London +123
2 X Y A,B 45678