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:

.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.