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

Add remark-math plugin to MarkdownEditor #1720

Closed
mofojed opened this issue Jan 10, 2024 · 2 comments · Fixed by #1734
Closed

Add remark-math plugin to MarkdownEditor #1720

mofojed opened this issue Jan 10, 2024 · 2 comments · Fixed by #1734
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@mofojed
Copy link
Member

mofojed commented Jan 10, 2024

As a Deephaven user, I want support for math syntax in markdown panels so that I can write math equations.

For example, writing the following in a markdown panel:

$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$

$(a+b)^2$

$$
\eqalign{
(a+b)^2 &= (a+b)(a+b) \\
&= a^2 + ab + ba + b^2 \\
&= a^2 + 2ab + b^2
}
$$

Should produce a mathematical output:

$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$

$(a+b)^2$

$$\eqalign{ (a+b)^2 &= (a+b)(a+b) \\ &= a^2 + ab + ba + b^2 \\ &= a^2 + 2ab + b^2 }$$

@mofojed mofojed added enhancement New feature or request triage Issue requires triage good first issue Good for newcomers labels Jan 10, 2024
@mofojed
Copy link
Member Author

mofojed commented Jan 10, 2024

We need to add the remark-math plugin. Details are at https://github.com/remarkjs/react-markdown#use-remark-and-rehype-plugins-math
Should add this to both MarkdownNotebook and MarkdownEditor (they should be using the same plugins).

@vbabich vbabich removed the triage Issue requires triage label Jan 16, 2024
@vbabich vbabich added this to the January 2024 milestone Jan 16, 2024
@wusteven815 wusteven815 linked a pull request Jan 19, 2024 that will close this issue
@mattrunyon
Copy link
Collaborator

Katex does not support the eqalign environment https://katex.org/docs/support_table.html#e

GitHub uses Mathjax https://github.blog/2022-05-19-math-support-in-markdown/

wusteven815 added a commit that referenced this issue Feb 8, 2024
- Adds #1720 
  - Updated `react-markdown` to `8.0.7`
  - Updated `remark-gfm` to `4.0.0`
  - Installed `rehype-katex 6.0.3`
  - Installed `remark-math 5.1.1`
  - Some of these are not the latest versions to match compatibility (with
React 17)
- Updated Jest config for pure ESM libraries (thanks to @mattrunyon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants