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

[Feature]: Preview for KaTex (math) #11

Open
vsimkus opened this issue Aug 14, 2021 · 10 comments
Open

[Feature]: Preview for KaTex (math) #11

vsimkus opened this issue Aug 14, 2021 · 10 comments

Comments

@vsimkus
Copy link

vsimkus commented Aug 14, 2021

Hi Caleb, great plugin! Do you have any plans for adding support for previewing math expressions? This is the main feature missing from this plugin for my use case :)

@CalebJohn
Copy link
Owner

Thanks! Yes, I do plan on adding katex rendering. The current plan is to include the Joplin renderer in the plugin, and use it to render images, tables, katex and anything else that will benefit.

@SeptemberHX
Copy link
Contributor

This package seems enough for rendering the math: https://github.com/SamyPesse/codemirror-widgets

@CalebJohn
Copy link
Owner

@SeptemberHX it can be rendered the same as an image. My holdup is that i want to support all Joplin special forms (mermaid, katex, etc.) without doing each individually.
Ideally the plugin would also support other plugins, but I'm not sure if that's possible with the plugin system, so might not ever get there.

@SeptemberHX
Copy link
Contributor

I think the image style renderer is not suitable for math because it still shows the ![]() things.

For math, it looks very messy with lots of inline math in a paragraph. I think we need to hide raw katex string and show rendered results instead.

@SeptemberHX
Copy link
Contributor

I successfully rendered katex inline math string to equation in the markdown editor. However, I notice serious performance issues when there are many rendered equations in the editor: It can take about 1 second to show your input. I think the problem maybe caused like codemirror/codemirror5#5873

@CalebJohn
Copy link
Owner

I think you can render to an image and display that instead. It should perform better.

@SeptemberHX
Copy link
Contributor

I think you can render to an image and display that instead. It should perform better.

Yes, I also think images should help. But unfortunately, I haven't found the solutions to convert katex rendered results to an image. There are some discussions about svg image as katex output in Katex repo, but currently there is no implementation for it.

@CalebJohn
Copy link
Owner

It looks like you might be able to use a generic tool like html2canvas for this. Although that specific one is in a beta state.

@SeptemberHX
Copy link
Contributor

It seems a good tool. I also check the obsidian's editor since it has already supported live preview markdown editor. It also directly insert the dom elements for rendered math, but it performs much better. Maybe it is related to codemirror 6 and mathjax.

@are-scenic
Copy link

are-scenic commented Jul 26, 2022

@CalebJohn, I am sorry for nagging. I wonder whether there is any progress with the KaTeX-rendering support.
(By the way, indeed this plugin is awsome and finally I can get rid of the preview panepain and save some screen space. Thank you for that 😃).

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

4 participants