mvdkwast / obsidian-copy-as-html

Obsidian plugin: copy document as HTML, including images
MIT License
42 stars 11 forks source link

Support of Mathjax/Latex #11

Open Gaaruda opened 1 year ago

Gaaruda commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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:

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 :)