Search

Dark theme | Light theme

June 4, 2014

Awesome Asciidoctor: Escaping Pipe Symbol in Tables

To define a table in Asciidoc is easy. Table cells are separated basically by pipe symbols (|). But if we want to use a pipe-symbol as cell content we need to escape the pipe-symbol with a backslash (\)

The following Asciidoc code is transformed to a correct HTML table output:

 
1
2
3
4
5
6
7
8
9
10
11
12
13
.Sample table with pipe-symbol in cell content
|===
| Operator | Method
 
| a + b
| a.plus(b)
 
| a - b
| a.minus(b)
 
| a \| b
| a.or(b)
 
|===

The generated HTML table looks like this for example:

Generated with Asciidoctor 0.1.4.