mavenasciidocasciidoctorasciidoctor-pdf

Multiple paragraphs in AsciiDoctor table cell


Edit: Since my problem seems to be specific to my setup, I provide a complete minimal working example here.

This is my maven setup (pom.xml):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>foo</groupId>
    <artifactId>bar</artifactId>
    <version>1.0-SNAPSHOT</version>

    <name>AsciiDoc Test</name>

    <build>
        <plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>1.5.3</version>
                <dependencies>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-pdf</artifactId>
                        <version>1.5.0-alpha.11</version>
                    </dependency>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj</artifactId>
                        <version>1.5.4</version>
                    </dependency>
                    <!-- beware, jruby 1.7.23 breaks asciidoctorj -->
                    <dependency>
                        <groupId>org.jruby</groupId>
                        <artifactId>jruby-complete</artifactId>
                        <version>1.7.21</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <sourceDirectory>${project.basedir}/src</sourceDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-pdf-doc</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>pdf</backend>
                            <doctype>book</doctype>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

This is my AsciiDoc source (src/test.adoc):

[cols="a"]
|===
|First paragraph

second paragraph

|===

The AsciiDoc file is compiled with:

mvn generate-resources

This is the generated output (target/generated-docs/test.pdf)

Why doesn't AsciiDoc render two paragraphs?

Other things that do not work as expected (every example pushes the whole cell content in one paragraph):

|===
a|First paragraph

second paragraph

|===
[cols="a"]
|===
|First paragraph

 * second paragraph

|===
[cols="1"]
|===

a|First paragraph

second paragraph

|===

Solution

  • From the documentation: http://asciidoctor.org/docs/user-manual/#cell

    The direct Asciidoctor PDF rendering do not support this yet. See #6


    This is what I get:

    With paragraph:

    [cols="1"]
    |===
    
    a|First paragraph
    
    second paragraph
    
    |===
    

    The relevant thing is the empty line between |== and a|your cell

    With the HTML renderer: Table with a second paragraph in Asciidoctor HTML

    With the PDF renderer: Table with a second paragraph in Asciidoctor PDF

    With list:

    It works the same way:

    [cols="1"]
    |===
    
    a|First paragraph
    
    * second paragraph
    
    |===
    

    With the HTML renderer: Table with list in Asciidoctor HTML

    With the PDF renderer: Table with list in Asciidoctor PDF


    A possible solution might be to use the DocBook Pipeline with jDocBook as in this example docbook-pipeline-jdocbook-example. With this setup I get the expected output:

    Complex Table example with the Asciidoctor docbook pipeline