Closed zkwinkle closed 5 months ago
Hey! Thanks for your kind words :)
Not just style. You need JavaSript.
Same with how you do syntax highlighting: if you only add CSS, it doesn’t yet do anything. As nothing cuts up the programming code into tokens for particular programming languages with classes.
You’d still need to load code to select the math. And pass it through a function to generate more things.
micromark-extension-math
can do more work because it is JavaScript itself. So it can use the KaTeX JavaScript library when doing its thing.
So, something like this pseudocode:
import katex from 'https://esm.sh/katex@0.16?bundle'
const nodes = Array.from(document.body.querySelectorAll('code.language-math'))
for (const node of nodes) {
katex.render(node.textContent, node, { throwOnError: false })
}
Okay so because I'm doing SSR I'd have to do this as part of the markdown->html compilation right? Which I believe makes this fall under the "needs plugins" category ( #32 )?
SSR is unrelated to this. JavaScript can also run in browsers. In fact, type setting of math might be problematic on the server side, as different users will have different fonts and different other settings.
I think this Q was answered.
Hello I need help getting the math extension working. I'm using the following options:
Notably
math_flow: true
andmath_text: true
.The options are doing something because writing
generates the following HTML:
I guess from here I'd have to style the
language-math
andmath-display
classes on my own? Any example CSS I can use?From issue #1 I see that the math extension is (inspired?) https://github.com/micromark/micromark-extension-math. Which has a section on CSS. But adding their stylesheet like
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css">
didn't help either.Also just wanted to add that this crate is awesome and perfect for my use case 😁. Thanks for your work!