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

Code Inline Footnote Causes Error #2388

Closed dragonstyle closed 1 year ago

dragonstyle commented 1 year ago

Thank you for your work on asciidoctor!

The following asciidoc produces an error when being converted to a PDF:

Reproducible Example

test.adoc

A code inline in a footnote on a code inline results 
in an `error`footnote:[For example, `code inline`, will produce an error].

Command

asciidoctor-pdf test.adoc

Produces error

asciidoctor: ERROR: failed to parse formatted text: A code inline in a footnote on a code inline results in an <code>error`<sup class="wj"><a id="_footnoteref_1"></a>[<a anchor="_footnotedef_1">1</a>]</sup>. (reason: Expected one of [^<&], '<', '&', '</' after <code>error`<sup class="wj"><a id="_footnoteref_1"></a>[<a anchor="_footnotedef_1">1</a>]</sup>. at byte 157)
asciidoctor: ERROR: failed to parse formatted text: <a id="_footnotedef_1"></a>[<a anchor="_footnoteref_1">1</a>] For example, `code inline</code>, will produce an error (reason: Expected one of 'br', 'img', 'a', 'strong', 'em', 'code', 'font', 'span', 'button', 'kbd', 'sup', 'sub', 'mark', 'menu', 'del' after < at byte 90)

Version

Asciidoctor PDF 2.3.4 using Asciidoctor 2.0.18 [https://asciidoctor.org]
Runtime Environment (ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin22]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)
mojavelinux commented 1 year ago

The described behavior is expected. The second backtick is not recognized as a markup character (since it is followed by a word character). Therefore, the code span runs from the word "error" to the word "inline" inside the footnote. It's necessary to use unconstrained monospace in order for it to recognize the code span followed by the footnote.

A code inline in a footnote on a code inline results 
in an ``error``footnote:[For example, `code inline`, will produce an error].