Help with Implementation of Equation Block #3331
Unanswered
tohhongxiang
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone, I'm currently trying to implement a markdown shortcut for an equation block, which transforms the following into an equation block (non-inline katex)
I wanted the transformer to be able to meet the following requirements:
$$
followed by a newline, their equation, another newline, and then closing with$$
, it will automatically convert to an equation blockI'm currently using an
ElementTransformer
to parse the text, and then convert the text into an equation block node. My current code looks something like this:I am then using this transformer and pass it into the
MarkdownShortcuts
plugin: (not the default one provided by@lexical/markdown
I also have a paste event handler:
This code was referenced from the
CODE
transformer and theEQUATION
transformerHowever,
replace
is not firing, and I'm not sure why. DoesregExp
only support single-line matches? What should I do to allowreplace
to trigger properly? Any pointers to the right direction is appreciated. Thanks for the great library!Beta Was this translation helpful? Give feedback.
All reactions