Skip to content
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

Support webtex for Github documents format #2301

Merged
merged 12 commits into from
Feb 14, 2022
Merged

Support webtex for Github documents format #2301

merged 12 commits into from
Feb 14, 2022

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Feb 3, 2022

This should resolve #1886 and #2003

This adds a math_method argument to github_document() so that equation can be rendered as an image in the resulting md document

---
output:
  github_document:
    math_method: "webtex"
---

Some content

$$
\int \frac{1}{x} dx = \ln \left| x \right| + C
$$

is rendered as


Some content

 \int \frac{1}{x} dx = \ln \left| x \right| + C


We ended up activating by default in github document where there is math. Like in Quarto.

We default to using PNG format with a DPI of 110 and using white background because otherwise (using svg for example) the equation would not be seen on dark mode in Github. We can't change the color font with the API.
However, Quarto defaults to SVG because this gives way cleaner output. Quarto documents how to change the background using PNG. Quarto doc about this: https://quarto.org/docs/output-formats/gfm.html#webtex-math

Should we default to the same ?

One thing is I am not sure about how we should consider CodeCog fair usage policy. https://editor.codecogs.com/docs/3-fair_usage.php, but I guess it is ok.

@cderv cderv requested a review from yihui February 11, 2022 14:39
Copy link
Member

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks!

@cderv cderv merged commit d1780eb into main Feb 14, 2022
@cderv cderv deleted the github-math branch February 14, 2022 17:26
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Improved math rendering in github documents
2 participants