-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[GH-1509] Add support for Latex rendering in markdown cells #1755
base: main
Are you sure you want to change the base?
Conversation
Hello @cphyc, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. Per the Mattermost Contribution Guide, we need to add you to the list of approved contributors for the Mattermost project. Please help complete the Mattermost contribution license agreement? This is a standard procedure for many open source projects. Please let us know if you have any questions. We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team. |
/check-cla |
webapp/src/utils.ts
Outdated
const paragraphRenderer = renderer.paragraph | ||
renderer.paragraph = (txt:string) => { | ||
const newTxt = txt.replace( | ||
/\$\$([^\$]*)\$\$/g, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewer: this only matches expressions like
$$ x = y $$ # will be matched
\( x = y \) # won't be
A discussion to have is whether we want things like
This is a very long line that contains a display equation in the middle. $$ x= y$$, does it even make sense to do that?
ae43b05
to
a6cb259
Compare
@cphyc We are evaluating how is the best way to handled this. sorry for the delay answering, but let me think a bit more about it and we can decide if we merge it or try to incorporate the existing code from mattermost. |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
Sorry, I still have to take a look into this. |
Any news on this front? |
Hi, this has been almost a year. Is there any hope of getting this merged or should I close the PR? |
Use built-in KaTeX error handling Swallow HTML line break that immediately follows latex displays This allows the equation to stay in the same paragraph (consistently with Latex behaviour) Update package-lock
This adds support for displaying inline and displayed Latex equations using Katex in markdown cells, fixing #1509.
The conversion happens before each paragraph is converted from markdown to HTML. At the moment, any parsing error thrown by KaTeX is caught and the chunk ignored. In other words, the following
$\thisisinvalid$
will render as-is, including the surrounding$
.Demonstration
Markdown editor
Automatic rendering when leaving the editor