pandoc-plantuml-filter
pandoc-plantuml-filter copied to clipboard
Generate PDF (pdflatex) with SVG instead of PNG image
Hi there, thanks for your work.
On line 39 you specify the use of PNG format in combination with latex.
By installing librsvg and its dependencies I managed to create a PDF with SVG as image output from plantuml.
brew install librsvg
On the terminal it produced the following issue:
Warning: Failed to set locale category LC_NUMERIC to en_DE.
Warning: Failed to set locale category LC_TIME to en_DE.
Warning: Failed to set locale category LC_COLLATE to en_DE.
Warning: Failed to set locale category LC_MONETARY to en_DE.
Warning: Failed to set locale category LC_MESSAGES to en_DE.
This is solved by exporting a locale that actually exists. In my case:
export LC_ALL=de_DE.UTF-8
I mentioned this in the issue I submitted for pandoc-mermaid-filter, but I think it's worth mentioning here too.
If we want to keep the default behavior that's there now, another potential solution is to try to read an environment variable that the user might set, and have this override the default behavior. Something like PLANTUML_FILETYPE
:
PLANTUML_FILETYPE=svg \
pandoc --from gfm --to html5 \
--filter pandoc-plantuml \
-o <name of output>.html <name of input>.md
A similar thing is done to specify the mermaid binary in pandoc-mermaid-filter.
Hi everyone, thanks for that great tool.
@MyriaCore We could use a pandoc variable to specify filetype
. That way, variable could be either declared inside document itself or injected through command line :
pandoc --from gfm --to html5 \
--filter pandoc-plantuml \
-V plantuml_filetype:svg \
-o <name of output>.html <name of input>.md
that's a cool idea, didn't know pandoc had those. They do seem better than using environment vars tbh.
I've since forked this to fulfill my needs, but would support this approach for sure.
For pdf, the format that gives best result for me is eps. Using svg, the shadows are still rasters and it's a bit ugly. Ex with eps (ok-ish, I don't like the font but it's acceptable):
with svg (a mix between vector and raster graphics... meh...):
Ideally, I'd have the "bob" of the svg format in the square of the eps ;-)
I'd also default to a graphic format for latex, not a png (but a variable like plantuml_filetype is ok for me).
That being said, on a regular basis, I'll choose a theme that won't have any shadow. In this case, maybe svg is better.