pandoc-ext / diagram

Generate diagrams from embedded code; supports Mermaid, Dot/GraphViz, PlantUML, Asymptote, and TikZ.
MIT License
53 stars 9 forks source link

allow SVG for any document format but keep high priority in non-PDF #10

Open garfvl opened 1 year ago

garfvl commented 1 year ago

Right now SVG (image/svg+xml) cannot be selected as a valid format for a diagram if the document output format is latex/context (so PDF as well).

As pandoc can convert SVG into some compatible format using rsvg-convert, This allows the SVG format to be in the preferred_mime_types list.

The previous behavior with non-PDF output formats is kept as is (raising the SVG format priority in the preferred_mime_types list).

tarleb commented 9 months ago

Thanks for the PR and apologies for the late reply.

I'm not sure I understand why this change would be needed/what the benefits are of allowing SVG for PDF output. Does it just change the converter from inkscape to rsvg-convert, or is there more to it?

garfvl commented 9 months ago

For what I understand from the code, inkscape is used to convert pdf to svg, not include SVG into a PDF output of pandoc.

having the diagram generation program able to output SVG and then convert it properly with rsvg-convert allows to include the SVG rasterization with proper dpi/resolution inside the pdf document. For example, using bitmap output for some diagram sources ends in very pixelized rendering in the final PDF generation.