asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.13k stars 500 forks source link

Surrounding text in content key of running content is dropped if image macro is on its own line #2495

Closed mojavelinux closed 5 months ago

mojavelinux commented 5 months ago

If the image macro is placed on a line by itself in the content key of the running content (header or footer), the converter is ignoring the surrounding text and treating the content as a block image.

footer:
  recto:
    left:
      content: |
        this text is dropped +
        image:logo.png[fit=line]

This is happening because the converter is looking for an isolated image macro (to treat as a block image) per line instead of across the whole value. When it finds the image macro on a line by itself, it mistakenly assumes it's the only content. That's why the text is dropped.

The workaround is to put an attribute reference in front of (or after) the macro to disrupt the match.

footer:
  recto:
    left:
      content: |
        this text is not dropped +
        {empty}image:logo.png[fit=line]