asciidocasciidoctorasciidoctor-pdf

How to keep list item on same page in asciidoctor-pdf?


I am using asciidoc to put together some user documentation. I need to end up with a PDF; I am using asciidoctor-pdf on Ubuntu (Asciidoctor PDF 1.5.0.alpha.18 using Asciidoctor 1.5.5)

I have asciidoc bulleted lists; some of the list item are text instructions interspersed with small screen shots. I want each list item to remain on the same page if possible.

These do not keep everything on the same page:

[options="unbreakable"]
* Use the virtual keyboard to enter the letters and numbers of your network password: +
image:ss/ss_password_done_blurred.png[]

This keeps everything together on the same page, but puts a box around the entire list item:

====
* Use the virtual keyboard to enter the letters and numbers of your network password: +
image:ss/ss_password_done_blurred.png[]
====

Is there a way to get ordinary paragraphs or list items to be unbreakable (or keep-together)?

Do I need to use a different tool chain than asciidoctor-pdf??


Solution

  • The first hack that comes to mind is just to hide the example block's border and background from view, so long as the block style suffices to keep your content together. Something like:

    example:
      border_color: ffffff
      border_radius: 0
      border_width: 0
      background_color: ffffff
      padding: 0
    

    The DocBook > PDF chain that Asciidoctor also provides might be better suited for you if you expect a lot more needs like this one. On the other end of that process, you have XSLT, which is far more powerful than the Prawn-based asciidoctor-pdf configuration. Be advised, that route may require more customization of the output to make it look modern/elegant the way asciidoctor-pdf does (IMO, no affiliation).