Closed rserranon closed 1 year ago
Could you provide your input document (or an equivalent example) as well?
I'm not sure what could cause this right away. The generated diagrams should be identical regardless of the asciidoctor backend that's being used.
Thanks, I'm working with this repository: https://github.com/chaincodelabs/onboarding-to-bitcoin-core, the particular file that have 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
I tried generating the PDF locally and I'm seeing the same result. The generated SVG images look fine though. That leads me to believe that there isn't really anything going wrong in the diagram extension itself, but that something is getting lost when the SVG images get embedded in the PDF. That part of the document generation flow is handled by the https://github.com/asciidoctor/asciidoctor-pdf project. I'm not too familiar with that myself. Might be best to open an issue there referring to this one.
If I understand it correctly, SVG files are converted to native PDF drawing instructions by https://github.com/mogest/prawn-svg. My hunch is that somethings going wrong in the font handling there.
Here is the open issue in asciidoctor-pdf repository https://github.com/asciidoctor/asciidoctor-pdf/issues/2384
It's not font handling. It's the fact that prawn-svg doesn't support foreignObject (which essentially just embedded HTML).
@mojavelinux thanks for taking a look! Thanks to your foreignObject
pointer (I hadn't looked at the generated SVG in that much detail yet) I found https://github.com/mermaid-js/mermaid/issues/2688. Seems like there's a mermaid option to disable HTML based labels. @rserranon perhaps that can be a workaround for you? Haven't tried it out myself yet.
Relates to:
Seems like there's a mermaid option to disable HTML based labels.
If you can see a way to disable HTML labels for other diagrams besides flow charts, do let us know! As far as I can tell, that option only applies to the one specific chart type.
I'm going to close this issue for now. The root cause of the problem is the fact that mermaid produces SVG with embedded HTML content. Fixing or improving that is out of scope for this project.
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:
If I generate the HTML with
asciidoctor -r asciidoctor-diagram index.adoc
all diagrams are generated correctly.