Build-time math rendering #10604
Replies: 1 comment
-
This is the "easy" part. You can achieve something like this in Quarto by changing the The hard part (maybe not even possible) is to do the work on the output of Pandoc. Unfortunately, Lua filters are run before Pandoc's format-specific writer, so there's no natural extension point to use. The best way I can imagine to do this is with a post-render script in a project, where the post-render script finds the .html files, parses them and calls whatever math renderer method you prefer. |
Beta Was this translation helpful? Give feedback.
-
Description
Hello!
I've used Astro for a while now for some technical writing, and it's not too dissimilar from Quarto in that I'm writing in Markdown and letting Astro render it to HTML.
One of the features I really like about Astro is that by adding a couple of plugins, I can get all the LaTeX equations to be rendered at compile-time as SVGs, rather than the traditional way of including the MathJax library from a CDN and having the equations be rendered by the client's browser.
This leads to much snappier loading and also avoids the infamous jumping behaviour that MathJax rendering causes on equation-heavy pages.
Under the hood, the plugins perform a two-step code transformation: one from Markdown to generic math HTML, and one that turns this into actual equations using either KaTeX or MathJax. This is demonstrated in the plugin readme: https://github.com/remarkjs/remark-math
Is this something that can be accomplished with Quarto extensions? And is there any appetite for having this as a feature?
Beta Was this translation helpful? Give feedback.
All reactions