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

Diagrams not generating text in pdf #2384

Closed rserranon closed 1 year ago

rserranon commented 1 year ago

I opened this issue in the asciidoctor-diagram repository https://github.com/asciidoctor/asciidoctor-diagram/issues/398

However, I'm also opening here because it's unclear where the problem might reside.

I'm generating a pdf with diagrams using asciidoctor-pdf -r asciidoctor-diagram index.adoc but diagrams are generated without text.

Here is my Gem list:

asciidoctor (2.0.18)
asciidoctor-diagram (2.2.3)
asciidoctor-diagram-ditaamini (1.0.3)
asciidoctor-diagram-plantuml (1.2022.5)
asciidoctor-pdf (2.3.4)

If I generate the HTML with asciidoctor -r asciidoctor-diagram index.adoc all diagrams are generated correctly.

I'm working with this repository: https://github.com/chaincodelabs/onboarding-to-bitcoin-core, the particular file that has the first diagram is https://github.com/chaincodelabs/onboarding-to-bitcoin-core/blob/master/02_architecture.adoc

There is a mermaid-config.json file in the repository with the following content:

{
    "themeCSS": ".label foreignObject { font-size: 85%; overflow: visible; }"
}

this is the settings.adoc

// Position toc on left and only display 4 deep
:toc:
:toclevels: 3
:toc: left
// Use pygments.rb for source highlighting, emacs style
:source-language: cpp
:source-highlighter: pygments
:pygments-style: emacs
// Use fancy icons for admonition boxes
:icons: font
// Add section links to HTML
:sectlinks:
// Set default imagesdir
:imagesdir: images
:docinfo: shared
// mermaid.js config
:mermaid-config: ./mermaid-config.json

mojavelinux commented 1 year ago

This is a known limitation with prawn-svg. It does not support external SVG tags such as foreignObject (which is just wrapping HTML). If prawn-svg can't render it, then Asciidoctor PDF won't be able to too. And prawn-svg is unlikely to ever support foreignObject (based on statements made in the issue tracker).

You'll need to find a way to configure mermaid to not generate HTML or find an alternate PDF converter.