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

$$ doesn't work #9

Open
Jojo-lan opened this issue Sep 10, 2024 · 6 comments
Open

$$ doesn't work #9

Jojo-lan opened this issue Sep 10, 2024 · 6 comments

Comments

@Jojo-lan
Copy link

When I print $$ and then insert the formula between them, it doesn't work because the input rule of tiptap doesn't support it. Would you please give me some ideas to fix it? Thank you.

@aarkue
Copy link
Owner

aarkue commented Sep 10, 2024

Hi @Jojo-lan,
could you provide the latex which is not working or maybe even a minimal example?

@Jojo-lan
Copy link
Author

For example, when I print $$ and then print sin(x) between them, the sin(x) won't be translated into latex formula, I think that is because the inputRule can't deal with this condition.

@aarkue
Copy link
Owner

aarkue commented Sep 13, 2024

So you mean something like this (where -> indicates progress of the user writing the expression):
$$ -> $si$ -> $sin(x)$

If yes, that's true but intended. There is not really an easy way to tell if the formula inside is "finished". For instance, why should it not convert $si$ to LaTeX already.

Thus, currently, the input rule will only trigger if you input the ending $.
So this should work: $ -> $si -> $sin(x) -> $sin(x)$.

I hope this explains the issue you experienced. If not or I misunderstood anything, let me know!

@Jojo-lan
Copy link
Author

Thank you so much! Now I got that inputRule can't deal with this condition. I wonder if there is anyway that I can deal with it. I create a custom node and use a method like tiptap/mathematics-pro-extenson to convert the text between $ into that node, when I do this $$ -> $s$ -> $si$ -> $sin(x)$ , the text is translated into my custom node immediately in the second step $s$, so I can't input the following words. In the pro-extension, the text is not converted into node so I can input the full word. Is it possible to convert text into node after inputing the whole word like this: $$ -> $s$ -> $sin(x)$->sin(x)[custom node]

@aarkue
Copy link
Owner

aarkue commented Sep 15, 2024

Yeah, the pro extension (I think) uses more underlying ProseMirror API surface for this to work.

If this is required for your use case, you could maybe try https://github.com/benrbray/prosemirror-math which uses a similar approach, as far as I know. It should be easy to also use this in TipTap (as it is built on top of prosemirror). However, I never tried it, as I personally prefer the approach of this package (i.e., LaTeX as full nodes and not text content).

Cheers :)

@Jojo-lan
Copy link
Author

Thank you so much, I will have a try😊

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