With Asciidoctor we can repeat cell contents if we prefix the cell separator pipe symbol (|
) with the number of times we want to repeat the cell followed by an asterisk (*
).
In the following example Asciidoctor source file we define two tables and add 2*
to cells that we want to repeat two times:
Continue reading →
Since Asciidoctor 1.5.0 we can use extensions when we write AsciiDoc documents. These extensions can be written in Ruby or any JVM language. If we use Gradle and the Asciidoctor Gradle plugin to transform our documents we can use both extensions. Of course an extension written in for example Java or Groovy can be included as a regular dependency in our build configuration. As the extension is on the classpath of the asciidoctor
task then it can be used. When the extension is a Ruby extension and available as a Ruby gem we need some more configuration in our build file. To use an Asciidoctor extension written in Ruby in our build we must first make sure that we can download the extension. Then we can configure the asciidoctor
task from the Asciidoctor Gradle plugin to use the extension.
Let's start with a sample Asciidoctor document which uses the Asciidoctor Diagram extension. With this extension we can embed diagrams as text in our document and get graphical images as output.
Continue reading →
In a previous post we learned how to use Asciidoc markup in a table. The a
character is just one of many styles we can define in our table. In this blog post we see which style options we have. We can either use the cols
attribute to define a style for a whole column or specify per cell the style.
We can use the following styles:
Continue reading →
When we define a table in Asciidoctor the columns all have the same width and the table will the whole width of the page. Of course we can change this when we define the table. We can change the table width with the width
attribute. We specify the column width with the cols
attribute.
First we will change the width of the columns. We can specify proportional integer values or a percentage to specify the width of a column. In the following sample Asciidoctor file we use proportional values in the first table. The first column has value 1
and the second column value 3
. This means the second column should be 3 times as wide as the first column. In the second table the column width is defined with percentage values. The first column should occupy 60%
of the table width and the last column the rest.
Continue reading →
When we define a table in Asciidoctor and want to use Asciidoc in a table cell it is not interpreted as Asciidoc by default. The text is literally shown and this might not be what we expect. But we can force Asciidoctor to interpret the cell contents as Asciidoctor.
Let's start with a very simple table. The last cell of the first row contains some Asciidoc markup:
Continue reading →
Creating a table with Asciidoctor is a breeze. The syntax is very clear and the HTML output shows a very nice looking table. But there is also a lot of configuration we can do when we define a table. For example by default all columns are left aligned, but we can change this to have values centered or right aligned in columns. We can even set the vertical alignment for columns. And if this is not enough we can change the horizontal and vertical alignment per cell.
Let's start with a simple table with three columns. We want the first column to be centered, the middle column to be left aligned and the last column should be right aligned. To achieve this we must configure the cols
attribute for our table definition. We use the following symbols to define the alignment:
Continue reading →