Open cderv opened 1 year ago
Christoph this is great! I've been wanting the same thing in gt as well (SVG-based formulas in non-LaTeX, non-Word output) but I'm really happy to see this work here in this package. We can definitely discuss this a bit more :)
As you want. I really don't know how this behave from email. I just wanted to show here how this could be done in a R Markdown output format.
Maybe you want to make this feature opt-in, and not opt-out in case of issues ? I used the default to webtex
here - you could still deactivate but let user opt-in webtex math is they agree ?
I am thinking about this because it requires internet connection for webtex to work and generate the svg.
Anyhow, if you feel good about this without testing some email client, feel free to add a news bullet and merge.
Dear RMD team, anything is happening on this front? We would really, really appreciate mathjax in emails. Please? :)
I think the images get sanitized by google
This is a POC to test how we could support math easily in blastula rmardown fomat following the improved support in rmarkdown
This first test is using
webtex
method which allow to use an online service to insert math as SVG (default) or PNG in HTML document. Hopefully self-contained image like SVG or PNG are ok to be included in email.Another possible method would be using the [katex]() R package https://docs.ropensci.org/katex/index.html that we support through
math_method: r-katex
in rmarkdown but this will require a specific CSS file.I don't how this CSS would behave in email client etc... This needs to be studied.
If none of this two solutions are possible for email format, this is harder and needs possibly specific adjustement somehow is possible.
Testing
Using this PR you can try rendering this document
Math formula will be inserted in email with a img and SVG data. It looks ok but require probably some CSS tweak.![image](https://user-images.githubusercontent.com/6791940/217557017-b5407229-964d-4224-a895-577cb333666d.png)
HTML code looks like
I don't think anything else is inserted in the document - to check.
@rich-iannone sharing that so you see what is possible. Happy to discuss this with you