benrbray / prosemirror-math

Schema and plugins for "first-class" math support in ProseMirror!
https://benrbray.com/prosemirror-math/
MIT License
253 stars 35 forks source link

Integration with Outline's `rich-markdown-editor` #32

Open Sadashii opened 2 years ago

Sadashii commented 2 years ago

How do I integrate prose mirror math?

benrbray commented 2 years ago

Are you using ProseMirror? Please take a look at the README file for instructions. You can also see a usage example in the docs-src/ folder.

Sadashii commented 2 years ago

Are you using ProseMirror? Please take a look at the README file for instructions. You can also see a usage example in the docs-src/ folder.

My bad sorry, I meant how do I integrate it in rich markdown editor

I've gone through a lot of issues and pages but didn't get it tbf

benrbray commented 2 years ago

prosemirror-math is a plugin for the ProseMirror rich text editor. It will only work if you are already using ProseMirror. Are you developing an application with ProseMirror?

Sadashii commented 2 years ago

I have an application making the use of rich markdown editor (https://github.com/outline/rich-markdown-editor) which is a prose mirror based editor and since prose mirror math is a plugin, I wanted to integrate this into my rich markdown editor although after reading a lot of articles/issues I wasn't able to.

benrbray commented 2 years ago

The example code here should be all you need to know to integrate this plugin with your ProseMirror instance. I'm not familiar with Outline, so it's possible that prosemirror-math is not compatible with the Outline editor.

Sadashii commented 2 years ago

Oh, uhh, thanks again for the time in that case

dominiczy commented 2 years ago

@Sadashii @benrbray I'm trying to do exactly the same, integrating this in Rich Markdown Editor (https://github.com/outline/rich-markdown-editor).

Tom has already done some good work here https://github.com/outline/rich-markdown-editor/pull/434.

But I can't get hydrating from markdown (e.g. persisting saved equations) to work. Loading markdown with $ delimited equations results in empty math blocks

Help really appreciated, could we please keep this open?

benrbray commented 2 years ago

Oh, I get it now, thank you @dominiczy for clarifying the question. I'll reopen the issue.

Contributions are very welcome to improve integration with other tools. I'd also be interested to hear how I can improve prosemirror-math to work in the collaborative setting. I'd be willing to help with this integration, but I'll need to learn more about Outline's rich-markdown-editor first, which I might not have time for until late January.

In the meantime I'm happy to answer any specific questions you might have as you try to get this working.

dominiczy commented 2 years ago

Not sure if this is going to help you, but there'a toDOM function in here (https://github.com/outline/rich-markdown-editor/pull/434/commits/25bfb199e51dc9370fc69879371b1443f179a046#diff-f8961edc2956977c3248eee0dbfb4f591c9a9dacaf9d2e748d314fde230f0f06R59) which should parse existing equations within the markdown and show them in the DOM, however when debugging the code it seems this is never called, which is probably part of the reason the equations aren't loaded. I don't understand the code deeply enough to make much progress though.

rich-markdown-editor powers our app Traverse.link, and being able to insert Latex within the markdown would be a game changer, helping people learn math, data science etc. Really awesome to hear you'd be willing to help with the integration - I'd also be happy to pay to get it prioritized

Sadashii commented 2 years ago

@dominiczy im not sure if I'll be much help since ts isn't really my thing, logic is but is it possible we could have a chat like maybe discord (Sadashi#8370) or such on this topic? I'd love to be able to help with this since having prosemirror math work would be amazing for us as well

dominiczy commented 2 years ago

@Sadashii I've sent you a request (my username is dominic#7254), I'll tell you where I'm at (I'm also not very experienced in prosemirror/markdown-it etc) and then we can figure it out together :)

dominiczy commented 2 years ago

I've fixed the basic integration, see my comment https://github.com/outline/rich-markdown-editor/pull/434#issuecomment-1014700845