Open lanitochka17 opened 4 weeks ago
Triggered auto assignment to @dylanexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
We think that this bug might be related to #Live Markdown
cc @mallenexpensify
Just need to add to Live Markdown project, I bumped to Weekly since the folks are prioritizing fixes over there. I'd await an update from them.
Hi! I'm Bartosz from SWM react-native-live-markdown
team.
I believe this issue could be handled by external contributors. It's probably going to require some changes in expensify-common
, because it seems like that's the part responsible for the issue. WDYT @mallenexpensify ?
Job added to Upwork: https://www.upwork.com/jobs/~0164dc21fd43760287
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External
)
Thanks @BartoszGrajdek , made external, help wanted
added too.
Asterisk on both sides of the text and an underscore are sent to the conversation without markdown style.
In the code:
the markdown parse.replace
is invoked.
The following regular expression is used:
But the regular expression cannot match _*test*
because of the \B
makes the * has to be the start of the word. test cases as below:
Replace the regular expression by
regex: /(?<!<[^>]*)(\b_|\B)\*(?![^<]*(?:<\/pre>|<\/code>|<\/a>))((?![\s*])[\s\S]*?[^\s*](?<!\s))\*\B(?![^<]*>)(?![^<]*(<\/pre>|<\/code>|<\/a>))/g,
replacement: (_extras, match, g1, g2) => {
if (g1.includes('_')) {
return `${g1}<strong>${g2}</strong>`;
}
return g2.includes('</pre>') || this.containsNonPairTag(g2) ? match : `<strong>${g2}</strong>`;
},
Explanation: \B
is used to exclude any words ahead of the asterisk *
. In the proposal, use (\b_|\B)
to exclude letters and special characters except underscore _
.
Test of expensify-common
passed.
NA
@dylanexpensify I feel like we need a list of rules around parsing syntax. This is another example of an issue where we keep on changing parsing rules and one thing and another breaks over time. I believe changing the parser open-endedly is not a good tactic.
Was this issue present since the inception? Or it is something new that we found today?
What if we solve this issue now and something else pops up?
@jp928 Does all other tests pass on ExpensiMark?
@parasharrajat The current ExpensiMark works with all other special characters except _, and not work with any letters.
https://github.com/Expensify/App/assets/659612/b9e5f6ac-467d-40f3-97d2-b89e7729ed86
@parasharrajat Also, just notice there is another \B to prevent the markdown end with a letter, so currently *b* end with a letter doesn't work either.
@jp928 Your solution does not pass tests for ExpensiMark.
@parasharrajat Thanks for reviewing. The proposal updated.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@parasharrajat @dylanexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@parasharrajat, @dylanexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
I will review this in sometime.
@jp928 So I was checking the italic parsing rule and I see that it works just fine *_test_
works.
Why can't we just pick the existing working solution? If you think your solution is better, could you please explain the reasons?
@parasharrajat I tried the italic parsing rule, it will fail some test cases.
/(<(pre|code|a|mention-user)[^>]*>(.*?)<\/\2>)|((\b_+|\b)\*((?![\s_])[\s\S]*?[^\s_](?<!\s))\*(?![^\W_])(?![^<]*>)(?![^<]*(<\/pre>|<\/code>|<\/a>|<\/mention-user>)))/g
this is what I used to test.
@jp928 Thanks for testing this. Could you please describe the problem or cases?
@parasharrajat There are more some cases the italic one can't handle: *sentence,*
*Here is a multi-line\ncomment that should\nbe bold*
, I just updated my proposal with minimum change to just fix the bug in this thread.
Thanks, I will review it.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
I will post the next update in few hours.
OK, Thanks. Let's go with @jp928's proposal. We need to adjust the regular expression for sure. We can test all the edge cases on PR and more unit tests for these edge cases.
:ribbon: :eyes: :ribbon: C+ reviewed
Triggered auto assignment to @hayata-suenaga, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@parasharrajat PR is linked but not sure if the package version update is needed.
I have read the CLA Document and I hereby sign the CLA
We will need two PR. One n e-common and one for package version upgrade on this repo.
📣 @jp928 You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing 📖
Sorry @hayata-suenaga, I didn't notice that you have yet to assign @jp928 and review the PR.
not problem 😄
@jp928 Waiting for your next PR.
@parasharrajat My first PR has been merged. Please advise what would be included in the next PR?
Now, you just need to create a PR to update the version of common package in this repo.
@jp928 @parasharrajat @dylanexpensify @hayata-suenaga this issue is now 4 weeks old, please consider:
Thanks!
@parasharrajat Would you like a patch or update the package.json? if we update the library version in package.json, it would include other commits.
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.85-6 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): nahummelaku9+cd1@gmail.com Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
A text in bold followed by an underscore is shown in the conversation
Actual Result:
Asterix on both sides of the text and an underscore are sent to the conversation
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/2c6199e1-a404-425d-af0f-de8a6117dcb7
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @parasharrajat