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.14k stars 501 forks source link

the string >; followed by a code callout breaks the code callouts #2390

Closed stallio closed 1 year ago

stallio commented 1 year ago

Inside a code listing, when the string >; is followed by a code callout, the callout breaks and the XML is dumped into the listing.

= listing test

.Test 1
----
 >; 
----

.Test 2
----
 >; <1>
----
<1> Callout breaks listing

Test 1 works but Test 2 returns the following error:

ERROR: failed to parse formatted text:  &gt� (reason: Expected ';' after &gt at byte 5)

mojavelinux commented 1 year ago

This issue comes from Asciidoctor core. The problem is that >; gets escaped to &gt;; and the callout replacer considers ;; to be the start of a line comment. So it gets swallowed up and messes up the line. You can work around this issue by setting the line-comment attribute on the block.

[line-comment=//]
----
>; <1>
----

You can also set the attribute to empty string to turn off the check for the line comment altogether.