Repository navigation
Conversation
yihui
left a comment
There was a problem hiding this comment.
Thanks! This looks good to me! Let's see if other people have any thoughts.
|
The new version of katex is now on CRAN. |
|
Thanks @jeroen ! @yihui I believe we should consider this while also looking at the old PR #1940 about support more math engine. This current PR here suggest to add a Unless we decide that current What do you think ? |
|
@jeroen I am currently working on #1940 for broader math support. Idea is to have YAML like this output:
html_document:
math:
engine: katex
url: https://cdn.jsdelivr.net/npm/[email protected]/dist/or output:
html_document:
math: mathmlI would bring support for server side using katex R package within this new logic output:
html_document:
math: r-katexor leveraging the url part output:
html_document:
math:
engine: katex
url: localMaybe you have other idea for this ? We could also have something more related to |
|
@jeroen Global math support has been merged now. This can be provided output:
html_document:
math_method:
engine: katex
url: https://cdn.jsdelivr.net/npm/[email protected]/dist/We should leverage this yaml structure for supporting katex R package for server side rendering. I can do the update on this PR. Do you have suggestion for the way to call the method ? Thanks |
|
So I have looked closer to how to support this with our new logic. From what I understand, katex server side processing with the R package suppose two things:
In the PR it was working Anyway, I'll probably do another PR instead of modifying this one if you don't mind. |
|
The render_math_in_html function queries the HTML document for nodes with Inside |
|
Thanks for the precision.
Without setting a math engine would have been great but Pandoc will warn every time it converts to HTML in the case no math processing is done. So ideally we need Pandoc to process Math but have no JS / CSS added in HTML head. |
|
For the record, I don't think In fact, Pandoc does not wrap equation in special chars when This would be the cleaner way IMO to apply the post processing for any document
For it to work with current rmarkdown:
This means that with non default template, setting will add the CSS and JSS for Mathjax. Not ideal. Am I right to believe that it would make sense for katex R package to work on the result of Anyway, I have opened #2304 to implement this based on current rmarkdown main instead of rebasing this PR. Hope it is fine. |
|
Closing this as #2304 has been merged. Thanks! |
This is mostly to test right now (it uses a feature in the katex package that is not yet on CRAN).
Here is a minimal example of what server-side math rendering could look like. I used this example math.Rmd. In the front-matter you can flip
katex: trueto compare the mathjax output vs katex output.I'd be interested to hear if this seems to work as expected.