-
|
From what I understand, Lexical does not have a transformer available to convert superscript text to markdown. So it sounds like I have to build a custom one. How do I do this? This is what I have so far, based on what I found on Google: I keep getting errors in my console related to the custom transformer "const" not being defined properly. Google has given me other examples, some that look wildly complex, but don't work either, and others with depreciated code, etc. I was hoping someone could guide me on the right way to create this custom transformer in 2025. Later on, I'll probably need to create others, such as for underlined text, spoiler text, text alignment, etc. I'm making some good progress with Lexical, pretty happy with it so far. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
What you want is a TextFormatTransformer, look at the existing ones for examples for how it works, they are all defined in export const SUPERSCRIPT_CARET: TextFormatTransformer = {
format: ['superscript'],
tag: '^',
type: 'text-format',
};Figuring out the rest is up to you. |
Beta Was this translation helpful? Give feedback.
What you want is a TextFormatTransformer, look at the existing ones for examples for how it works, they are all defined in
MarkdownTransformers.ts. Would look something like this:Figuring out the rest is up to you.