I'm running asciidoctor with the following command:
asciidoctor -r asciidoctor-pdf -b pdf master.asciidoc
And it fails to parse the following text:
pass:[<a data-type="xref" data-xrefstyle="ct" href="#m1">#m1</a>]::
With the following error:
failed to parse formatted text: <a data-type="xref" data-xrefstyle="ct" href="#m1">#m1</a>
How can I fix it?
Asciidoctor with backend PDF does only have limited support for passthrough syntax as the documentation states.
While the
a
tag is mentioned above a small test shows that only basic syntax is supported.Using the below adoc file...
Running it through the asciidoctor pdf backend produces the same error as you already mentioned in your question.
The resulting PDF looks like the below screenshot. The simple
<a href="#m1">#m1</a>
line is properly converted. But as soon as further attributes are added it fails. This is in sync with the documentation stating advanced html syntax is not recognized by the pdf backend.To generate a PDF with the desired passthrough you may want to convert it with plain
asciidoctor
and pipe it to wkhtmltopdf.The result uses the html look and feel of as shown below with slightly smaller body text.