pandoc / dockerfiles

Dockerfiles for various pandoc images
GNU General Public License v2.0
364 stars 98 forks source link

Add rsvg-convert for SVG conversion #154

Closed hschwentner closed 2 years ago

hschwentner commented 2 years ago

Since 2.15 Pandoc supports automatic conversion of SVG files for DOCX output. For that to work it requires rsvg-convert. I added the install of that tool to the dockerfile.

tarleb commented 2 years ago

:+1: on the change. The Ubuntu build fails because focal, on which the image is built, ships with librsvg2-bin version 2.48.9*.

tarleb commented 2 years ago

Also, could you check how much this will add to the image's size? I'd expect it to be a few MB, which would be fine; but we may want to reconsider if it's significantly more than that.

hschwentner commented 2 years ago

I've changed the librsvg2-bin version to 2.48.9* and now it builds. Thanks for the hint; I didn't think of using the LTS version... :-)

As for the size: the artefacts built by GitHub Actions are 88mb (Ubuntu) and 53mb (Alpine) with ligrsvg2.bin as compared to 63mb (Ubuntu) without. I hope that's ok. Or do you think there should be a pandoc-docx image besides pandoc-core and pandoc-latex?

tarleb commented 2 years ago

Mmmh. That's quite a jump. The unpacked image size for Ubuntu increases by ~69MB from 250MB to 319MB.

Let me think about that for a bit. Opinions welcome!

hschwentner commented 2 years ago

After thinking about this, I still see two solutions:

  1. Build a separate image pandoc-docx besides pandoc-core and pandoc-latex
  2. Live with the increase in size

A quick fix could be to start with 2 and move later to 1.

tarleb commented 2 years ago

Another thought: rsvg is included in pandoc/latex images; those can also be used to convert docx. That means there is the additional option of saying "users who need rsvg should use the latex images". Of course, that's not intuitive and would need to be documented.

hschwentner commented 2 years ago

How about renaming pandoc/latex to pandoc/full or similar, then? That would make it more intuitive and a user could see:

tarleb commented 2 years ago

I like the idea of this, but it might be misleading, too: non-LaTeX PDF generation options are missing from pandoc/latex images. Adding wkhtmltopdf, weasyprint, groff, and context, all supported options for --pdf-engine and required to justify the name full, would result in a huge image.

I'm currently leaning towards renaming core to minimal, and make the new core as minimal+rsvg. I'm just not sure if I have the time for that right now.

tarleb commented 2 years ago

I'm adding a minimal image, so we can add this to core now in good conscience. The PR would require a rebase, which is probably more effort than it's worth, which is why I'm closing this. I'm still making the necessary changes, of course.

Thank you for bringing this up!