-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
How to get math working #94
Comments
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.
So, something like this pseudocode: import katex from 'https://esm.sh/[email protected]?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. |
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/[email protected]/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!
The text was updated successfully, but these errors were encountered: