dockerfiles icon indicating copy to clipboard operation
dockerfiles copied to clipboard

Bundle JS libraries (KaTeX, reveal.js, etc)?

Open cben opened this issue 5 years ago • 8 comments

What do you think of bundling the various libraries needed for --katex, --mathjax, --to=slideous, --to=revealjs etc. to be able to produce --self-contained HTML files without having to download anything extra?

I know this is debatable, could also ask why not bundle them with the pandoc binary/installer releases... But the pandoc/latex container already took the step of bundling a huge dependency, which is very convenient (thanks! 🙏). So in same spirit, would you like PR(s) to add those?

This of course opens a can of worms of which version to bundle... Latest known compatible at time image was built?

  • [ ] need to track down licenses... Some of these like Slidy and S5 date to the early web and don't have modern code repositories, at best a .zip.

  • [ ] estimate total size to decide whether these are negligible, or justify a separate pandoc/html image to keep pandoc/core small?

cben avatar Jun 05 '20 15:06 cben

I'm generally open to this, as those libraries are comparatively small (I think). However, I'm unsure how this would work in practice: mathjax, slideous, and reveal.js are not required for producing documents, but must be available when viewing. Could you outline the workflow you had in mind?

tarleb avatar Jun 05 '20 15:06 tarleb

Correcting myself: using pandoc with --self-contained requires those tools to be present while compiling (but some functionality is lost when doing that).

I see that reveal.js is ~5 MB when uncompressed. About half of that are fonts. This is big, but not too bad. I lean towards not including it at this point unless we provide a separate html image – for which there are no plans right now. I'm not sure. @svenevs, what do you think?

tarleb avatar Jun 07 '20 06:06 tarleb

In private communication @svenevs raised the idea that that this could go into a presentations image which would be based on the latex image.

tarleb avatar Jun 08 '20 19:06 tarleb

Agreed, we need to flesh this out a bit more but the idea is to just stuff anything presentation related (beamer, reveal, etc) into a derivative image (inheriting from latex).

I am not super familiar with KaTeX though, how does that come in?

svenevs avatar Jun 09 '20 00:06 svenevs

AFAIK pandoc/latex image already contains everything you need for beamer presentations. Unless you mean to narrow down the /latex image to not contain beamer? I'm not sure how much that saves.

KaTeX or MathJax are JS libraries used for math rendering in both regular and presentation slides flavors of HTML.

Self-contained mode is especially useful for presentation files because you don't want to go up and starts presenting only to discover the conference WiFi is overloaded and you can't connect to the CDN 🙃 There are other offline scenarios of course.

cben avatar Jun 09 '20 08:06 cben

(There is by the way another way, to pre-process with KaTeX or MathJax generating the output HTML, without even needing JS when viewing. The resulting file is also smaller. Originally JS was critical as the output used to be browser-dependent, but nowdays you can get good portable math with just html+css. Pandoc doesnt support this out of the box, probably because it'd add NodeJS as a dependency, but there are pandoc filters to achieve this. I don't think you'll want this in official image.)

cben avatar Jun 09 '20 08:06 cben

Keep in mind that the reveal.js presentation mode does not work when using pandoc --self-contained.

tarleb avatar Jun 09 '20 08:06 tarleb

Unless you mean to narrow down the /latex image to not contain beamer?

I think I misunderstood, the idea was to have like pandoc/presentation or something. And include every possible thing pandoc can wield in the slide generation domain. It sounds to me like you're saying that KaTeX / MathJax / slideous / reveal etc the other things don't actually need latex, in which case we could still make pandoc/presentation and just say "everything but beamer, use pandoc/latex for that"?

I definitely like the idea, but I'm not going to be able to go through all of the details and identify what needs to be installed where / how / doc how to use it at this time. Help very welcome :slightly_smiling_face: To test you can just edit the core Dockerfile if you are uncomfortable editing Makefile.

Even if we don't end up creating a new image, docs on how to use these specifically in the way you describe (offline-safe presentation slides) would be very helpful I'm sure.

svenevs avatar Jul 02 '20 14:07 svenevs