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

Auto render Katex #9

Open
enaguero opened this issue May 15, 2022 · 2 comments
Open

Auto render Katex #9

enaguero opened this issue May 15, 2022 · 2 comments

Comments

@enaguero
Copy link

First of all, thank you for creating this initiative! It looks the most promising for our the ruby/rails environment. I am looking forward to see if there is any option to use the auto-render extension or if there any plan to built one in ruby. My main problem using Katex with a possible auto-render alternative is finding the appropriate regex to identify all the possible LATEX code in a given string.

Any guidance how I could accomplish this would be appreciated. In case there is not such a possibility, I am more than happy to start a possible collaboration to include this option in katex-ruby.

@glebm
Copy link
Owner

glebm commented May 15, 2022

to use the auto-render extension

This gem is for rendering KaTeX server-side.
The auto-render extension in KaTeX is for client side rendering. If you want to render client-side, you can just use the KaTeX npm package directly.

If you use markdown and want to render client-side, you can use this Kramdown plugin https://github.com/kramdown/math-katex

@enaguero
Copy link
Author

@glebm, thank you for your feedback. I am not a native English speaker, so maybe my question was not very clear; sorry about that. However, I wonder if we could create an option where Katex receives a text string with several latex strings (inline or not), and it's converted to HTML on the server-side like:

text_to_html = "Here is the equation $c = \\pm\\sqrt{a^2 + b^2}$, please compare the result with $x = sqrt{a^2 + b^2}$" 
Katex.render text_to_html

I hope my doubt or initiative is more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants