Skip to content

[Feat] Add LaTeX syntax support for math in notes #382

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

Merged
merged 1 commit into from
Jul 22, 2023

Conversation

li-xin-yi
Copy link
Collaborator

@li-xin-yi li-xin-yi commented Jul 20, 2023

Use prosemirror-math to add math support for text editors. Support both math in-line and display.

math-demo

Usage:

  • Copy formula directly from some website (e.g., Wikipedia) and paste to a note node.
  • To start an in-line math formula, type $ and give a string of LaTeX code, type a $ to make a end, then the formula appears.
  • To start a displayed math, type $$ in the beginning of the line and press a space, then you will enter the formula mode, just type LaTeX code.
  • To edit an existing math stuff, move your cursor into it (either by key or mouse), the LaTeX code is exposed and you can edit now. To exit the edit mode, just move your cursor out of the math environment.

Known bugs:

  1. Displayed math ($$...$$) can't be started at the first line in an empty note node

@@ -35,6 +36,7 @@
"graphql": "^16.6.0",
"html-to-image": "^1.11.11",
"jwt-decode": "^3.1.2",
"katex": "0.13.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool trick 😄

@li-xin-yi
Copy link
Collaborator Author

li-xin-yi commented Jul 21, 2023

Update:

Displayed math ($$...$$) can't be started at the first line in an empty note node

I found this bug disappears once I turn off the Grammarly Chrome extension. I can't explain why, but anyway it can be one solution...

@lihebi
Copy link
Collaborator

lihebi commented Jul 21, 2023

turn off the Grammarly Chrome extension

It works for me even if I have the Grammarly extension on. Maybe this bug doesn't exist.

@lihebi
Copy link
Collaborator

lihebi commented Jul 22, 2023

I love this feature. Thanks, Xinyi!

@lihebi lihebi merged commit 213f411 into codepod-io:main Jul 22, 2023
@lihebi lihebi linked an issue Jul 22, 2023 that may be closed by this pull request
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

Successfully merging this pull request may close these issues.

LaTeX support in richtext pods
2 participants