-
-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved math rendering in github documents #1886
Comments
Interesting. Your reference shows inline math, and I tested display math is also available. ![](https://render.githubusercontent.com/render/math?math=e%5E%7Bi%20%5Cpi%7D%20%3D%20-1&mode=display) |
At the moment I was thinking about doing a script in R which convert the actual include code by markdown. but surely something native would be better. |
A script in R is possible, but I'm sure developers go into regex-hell. |
Here's a lua filter. https://github.com/atusy/lua-filters/blob/master/lua/math-github.lua I wanna make some improvements so to
After that, maybe we can add the lua filter to |
ehm, sorry the silliness but, how does one use it? 😆 |
Download the file and render something like
|
I noticed that webtex will be a better solution from https://pandoc.org/MANUAL.html#option--webtex . |
ok, thanks! |
It seems with latest Pandoc, math are transformed into markdown directly. ---
title: "Basic Stats"
output: github_document
---
$e^{i \pi} = -1$ will output Basic Stats
================
*e*<sup>*i**π*</sup> = − 1 Which renders as Basic Statsei**π = − 1 It seems the change in Pandoc 2.10.1 with it is note quite perfect because there is 2 This can be seen easily if you are using RStudio 1.4 preview, as it is shipped with recent Pandoc and you should see the difference. This happens with several formats $ pandoc -t gfm <<< '$e^{i \pi} = -1$'
*e*<sup>*i**π*</sup> = − 1
$ pandoc -t commonmark <<< '$e^{i \pi} = -1$'
*e*<sup>*i**π*</sup> = − 1
$ pandoc -t commonmark_x <<< '$e^{i \pi} = -1$'
$e^{i \pi} = -1$
$ pandoc -t markdown_strict <<< '$e^{i \pi} = -1$'
*e*<sup>*i**π*</sup> = − 1 |
It seems
There is discussion about this here: https://groups.google.com/g/pandoc-discuss/c/gYIXVJ944S0/m/wYZgs6cnBQAJ It won't work with complex equation where it is not converted and leave as is ---
title: "Basic Stats"
output: github_document
---
$$
Sensitivity \equiv TPR = \frac{TP}{OP} = P(T+ | D+) = 0.938
$$ I think adding Example: ---
title: "Basic Stats"
output:
github_document:
pandoc_args: "--webtex"
---
Inline math: $e^{i \pi} = -1$
Display math:
$$
\frac{e^{i \pi}}{10}
$$ |
Thanks for the news on latest pandoc.
What do you mean by only inline math? BTW, I have opened PR #1940 to support variety of math rendering engines on HTML formats. |
When I try the above using latest Pandoc (2.11.3.2) it does not work with the display equation. Seems like a regression with Pandoc. I saw your PR. I need to take some time looking through it and through the different options for this. We'll discuss there. |
Sharing here that a new package by rOpenSci in on CRAN now : https://docs.ropensci.org/katex/reference/katex.html. It enables server-side math-to-html rendering in R, such that no javascript library is needed in the html document. It would maybe help with this specific issue of github document |
I'm face with the some problem. I end up write these functions below. I use it for my blog based on Hugo. Adding
The |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Hello,
I recently stumble upon this solution for having math formulas in github readme documents which provide much better quality images than the current system: https://gist.github.com/a-rodin/fef3f543412d6e1ec5b6cf55bf197d7b
Could it be a good improvement?
The text was updated successfully, but these errors were encountered: