Open robfig opened 1 year ago
Oh interesting, createTextFormatTransformersIndex
does indeed add a negative lookbehind for escaping. I'm not sure why it's not working at this point.
OK, it's the switch here that adds the negative assertion depending on userAgent. It turns out my Jest test is classified as IS_APPLE_WEBKIT (user agent "Mozilla/5.0 (linux) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/20.0.3"), although I think it should support the regexp.
So maybe the fix is to change the condition under which it's not used?
if (IS_SAFARI || IS_IOS || IS_APPLE_WEBKIT) {
fullMatchRegExpByTag[tag] = new RegExp(
`(${tagRegExp})(?![${tagRegExp}\\s])(.*?[^${tagRegExp}\\s])${tagRegExp}(?!${tagRegExp})`
);
} else {
fullMatchRegExpByTag[tag] = new RegExp(
`(?<![\\\\${tagRegExp}])(${tagRegExp})((\\\\${tagRegExp})?.*?[^${tagRegExp}\\s](\\\\${tagRegExp})?)((?<!\\\\)|(?<=\\\\\\\\))(${tagRegExp})(?![\\\\${tagRegExp}])`
);
}
Hello, I created a pull request that fixes this issue and #4808, you can see if it fits your requirements here: #4813
Hi everyone.
Any update on this? Note that at the moment, neither import nor export handle the text content escaping, making the markdown support less reliable for production use.
Will @ratasorin's code be reviewed and hopefully merged soon?
Duplicate of https://github.com/facebook/lexical/issues/2715?
Steps To Reproduce
\*Hello\*
here to see that it is valid markdown which is rendered as expected: https://spec.commonmark.org/dingus/\*Hello\*
Expected: It populates the WYSIWYG editor with the literal text
*Hello*
Actual: It displays \Hello\
This is because it ignores the escaping and treats the surrounding asterisks as a format to be applied. The process of applying the text formats should do a negative lookbehind assertion to confirm that the previous character is not a backslash.
Before import
After import