Skip to content
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

Quotes inside codeblocks removes all formatting #179

Closed
viniciusyoshioka opened this issue Feb 11, 2024 · 5 comments
Closed

Quotes inside codeblocks removes all formatting #179

viniciusyoshioka opened this issue Feb 11, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@viniciusyoshioka
Copy link

Description

When using MarkdownTextInput the written text is formatted properly. However, when pasting some markdown text, the pasted text is not formatted. Even if I erase and type again, the text formatting does not update.

I didn't find if its intentional, but I believe its not, so I opened the issue.

Platform

This bug is on Android. I can't check if its present on other platforms.

Other details

React Native version: 0.73.4
@expensify/react-native-live-markdown version: 0.1.5
Android's version: 13
JS Engine: Hermes
Archtecture: Old

@tomekzaw
Copy link
Collaborator

@viniciusyoshioka Thanks for opening this issue. Would you be able to share with us a screen recording that shows the problem so we have a better understanding on how to reproduce it?

@viniciusyoshioka
Copy link
Author

@tomekzaw Yes, sure!

https://github.com/Expensify/react-native-live-markdown/assets/71671043/52ee9a5e-b6a8-4121-ba94-4ea3df15b672
Screen recording 1

https://github.com/Expensify/react-native-live-markdown/assets/71671043/9998bb19-584c-4a29-96dd-1627090427b0
Screen recording 2

In "Screen recording 1", I reproduced the problem. After typing some markdown text, I paste another text and then the formatting is not applied in the whole component.

While recording, I realized something that can be a real bug, and recorded it in "Screen recording 2". The formatting seems to be working fine, even when pasting text, I'm sorry for not testing more before.

But I found what is causing this. Having single or double quotes inside code block (the one with 3 backticks), removes the whole formatting. After erasing the quotes from inside the code block, the formatting returns.

@tomekzaw
Copy link
Collaborator

@viniciusyoshioka Thank you very much for preparing the screen recordings and your investigation.

You are right, there is a bug in parsing blockquotes if they contain characters like ", ', & and some others.

If there is a bug while parsing Markdown, we simply remove all formatting. This also helps us identify such cases.

I believe this has been already adressed by @robertKozik, we will submit a PR with a fix. Thank you!

@viniciusyoshioka viniciusyoshioka changed the title Text pasted into MarkdownTextInput is not formatted Quotes inside codeblocks removes all formatting Feb 11, 2024
@robertKozik
Copy link
Collaborator

Hi @viniciusyoshioka Once again thanks for reporting this issue! The issue is indeed inside the parser, as to be more precise data inside the codeblock was escaped twice - which was breaking our checks. That leads to remove the formatting.

This PR should resolve this problem: #140

@viniciusyoshioka
Copy link
Author

Hi @robertKozik!

I have tested the pull request with every character available in my keyboard and it is working perfectly.

Thank you @tomekzaw and @robertKozik for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants