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

Support of Mathjax/Latex #11

Open
Gaaruda opened this issue Nov 19, 2022 · 6 comments
Open

Support of Mathjax/Latex #11

Gaaruda opened this issue Nov 19, 2022 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Gaaruda
Copy link

Gaaruda commented Nov 19, 2022

The plugin you made is almost perfect but just this issue that it can parse latex properly.

What I would Like is that it converts latex to image, just like the way you are dealing with excalidraw images.
there are many websites out there which deals with that is coverting latex to image.

Thanks For your Plugin.
And Please support this feature, as early as possible.

@mvdkwast
Copy link
Owner

Great suggestion ! I will definitely look into this. I'd prefer to use an offline library for conversion, I'll have to do some research...

@Gaaruda
Copy link
Author

Gaaruda commented Nov 20, 2022

Great suggestion ! I will definitely look into this. I'd prefer to use an offline library for conversion, I'll have to do some research...

the excalidraw in obsidian developer has also implemented the latex feature in excalidraw you may also even ask him for suggestions.

mvdkwast pushed a commit that referenced this issue Nov 21, 2022
- embed MathJax as SVG
- embed MathJax as bitmap
- added styling: .math-inline, .math-block

closes #11
@mvdkwast
Copy link
Owner

mvdkwast commented Nov 21, 2022

@Gaaruda, I could not use the same approach as with Excalidraw, since the MathJax is rendered as HTML elements, not SVG. So I did my own rendering and replace the MathJax HTML nodes.

Some issues:

  • in bitmap mode, gmail and google docs don't support the vertical alignment in pixels. This may not be fixable.
  • in svg mode, it works with gmail, but the document is duplicated (gmail bug, not related to this feature)
  • quality is a bit degraded in bitmap mode (might be possible to improve this)
  • sane editors like this one render it fine.

And Please support this feature, as early as possible.

Since you're asking someone who doing this in his free time to hurry, feel free to test the above branch and provide feedback 😉

The .math-inline and .math-block can be used for styling.

@Gaaruda
Copy link
Author

Gaaruda commented Nov 21, 2022

Since you're asking someone who doing this in his free time to hurry, feel free to test the above branch and provide feedback 😉

How can Test this plugin, as I am unable to see a main.js file.

mvdkwast pushed a commit that referenced this issue Nov 21, 2022
@mvdkwast
Copy link
Owner

I assumed you knew how to compile a plugin since you have one in your repositories. I pushed a commit with the main.js.

mvdkwast pushed a commit that referenced this issue Nov 21, 2022
@mvdkwast mvdkwast added the enhancement New feature or request label Nov 30, 2022
@mvdkwast mvdkwast added the help wanted Extra attention is needed label Jan 14, 2023
@mvdkwast
Copy link
Owner

The implementation works, but adds 2MB to the plugin because it includes the entire MathJax lib and its fonts, which is kind of redundant because Obsidian should already have them.

If anyone can come up with a better implementation, I'd be glad to merge it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants