Support custom parsing logic (pass worklet as parser prop)#439
Support custom parsing logic (pass worklet as parser prop)#439
parser prop)#439Conversation
|
Regression: toggling font size doesn't work properly Screen.Recording.2024-11-06.at.13.53.44.movIt works correctly if there's a blockquote ( Screen.Recording.2024-11-06.at.14.01.11.mov |
|
any update on this? |
|
@bbaoNg97 This PR is currently in internal review. |
|
TODO: check in release mode |
8ce4ae5 to
5c14608
Compare
|
Hi, thank you for this fix. Unfortunately I think the patch here is causing install issues for yarn users: #573 |
| if (markdown.length > MAX_PARSABLE_LENGTH) { | ||
| return []; | ||
| } | ||
| try { |
There was a problem hiding this comment.
Hi @tomekzaw, coming from Expensify/App#54522, we're facing the issue when text and markdown are different then the error will be thrown. If so users can't perform their action. I don't think we should remove try/catch here. Can you please help take a look? Thank you.
There was a problem hiding this comment.
It was a deliberate decision to remove try/catch block so we can show a RedBox with the error if something fails.
However, looks like I forgot about the case when Markdown message before and after parsing don't match. I think we should show a warning and return an empty array in such case, like this:
if (text !== markdown) {
console.warn(
`[react-native-live-markdown] Parsing error: the processed text does not match the original Markdown input. This may be caused by incorrect parsing functions or invalid input Markdown.\nProcessed input: '${JSON.stringify(
text,
)}'\nOriginal input: '${JSON.stringify(markdown)}'`,
);
return [];
}
Details
This PR removes separate JS bundle with ExpensiMark logic and allows for customizing
MarkdownTextInputformatting logic viaparserproperty. Parser needs to be a function that accepts a plaintext string and returns an array of ranges.Related Issues
#317
Manual Tests
Linked PRs