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

[$250] Code blocks of only spaces don't render #31633

Closed
6 tasks done
lanitochka17 opened this issue Nov 21, 2023 · 38 comments
Closed
6 tasks done

[$250] Code blocks of only spaces don't render #31633

lanitochka17 opened this issue Nov 21, 2023 · 38 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 21, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.1-7
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
**Issue reported by:**Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to any chat
  2. Send a text wrapped in two spaced backticks(Eg. Hello ). i.e Have a space between the backticks

Expected Result:

he backtick should be in the code block

Actual Result:

One Backtick is out of the code block

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6285284_1700561421497.test3_Backtick.mp4

Bug6285284_1700561421464!image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01369e16f895581dbb
  • Upwork Job ID: 1726984904265334784
  • Last Price Increase: 2024-04-17
  • Automatic offers:
    • hoangzinh | Reviewer | 0
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 21, 2023
@melvin-bot melvin-bot bot changed the title Compose Box - One backtick is outside the code block [$500] Compose Box - One backtick is outside the code block Nov 21, 2023
Copy link

melvin-bot bot commented Nov 21, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01369e16f895581dbb

Copy link

melvin-bot bot commented Nov 21, 2023

Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 21, 2023
Copy link

melvin-bot bot commented Nov 21, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Nov 21, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (External)

@s-alves10
Copy link
Contributor

s-alves10 commented Nov 21, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

One backtick is outside the code block when we send hello

What is the root cause of that problem?

Here is the regex for the inline code block

        regex: /(\B|_|)&#x60;(.*?\S.*?)&#x60;(\B|_|)(?!&#x60;|[^<]*<\/pre>)/g,

As you can see, we add negative lookahead assertion ?!&#x60; to take the last backtick but didn't take care of the space characters before it.

This is the root cause

What changes do you think we should make in order to solve the problem?

We need to consider the cases where spaces exist before the backtick
Update the above regex to

        regex: /(\B|_|)&#x60;(.*?\S.*?)&#x60;(\B|_|)(?!(\s*&#x60;)|[^<]*<\/pre>)/g,

This works as expected

Result
31633.mp4

What alternative solutions did you explore? (Optional)

In cases we want to parse spaces as a valid code like github, we can update the above regex to

         regex: /(\B|_|)&#x60;(.*?[\S ].*?)&#x60;(\B|_|)(?!&#x60;|[^<]*<\/pre>)/g,
31633_alternative.mp4

@twisterdotcom
Copy link
Contributor

Surely this is a regression from somewhere right? cc @parasharrajat or @allroundexperts might know. I feel like we test markdown endlessly.

@hoangzinh
Copy link
Contributor

@s-alves10 are you able to find any regression PR recently causing this bug? or it's a new case that we haven't handled before?

@s-alves10
Copy link
Contributor

Inline code regex was changed 3 months ago but that change didn't cause this issue.
I don't think this is a recent regression

@parasharrajat
Copy link
Member

@twisterdotcom I don't see any recent PR that caused this. but I agree with you that we test MD endlessly. In the past, I raised the same concern and suggested that we should create a ruleset for all MD syntax. I guess we are still on that step. We should create one to make sure we are not redoing it. Let me know your thoughts.

@hoangzinh
Copy link
Contributor

@s-alves10 I tried to apply your proposal but it causes a unit test in expensify-common repo failure. Could you check again? Thanks

Screenshot 2023-11-24 at 08 57 41

@s-alves10
Copy link
Contributor

@hoangzinh

` ` hello ` `
``` ```

Comparing the above two cases, the first case needs to extend the inline code block content as possible including the space character, and the second case needs to extend the content as possible not including the space.

We need to set clear expectation here

Note: I've found that there are some differences in inline code block parsing between GitHub and Expensify. I'd like to know what the Expensify rule is based on

@melvin-bot melvin-bot bot added the Overdue label Nov 27, 2023
Copy link

melvin-bot bot commented Nov 27, 2023

@twisterdotcom, @hoangzinh Whoops! This issue is 2 days overdue. Let's get this updated quick!

@hoangzinh
Copy link
Contributor

We need to set clear expectation here

Agreed. @twisterdotcom @lanitochka17, the expectation is not clearly enough. Could we describe it more clearly? Thanks.

Given user type

` ` hello ` `

What is our expectation in compose box?

  1. hello (2 code blocks on 2 sides of hello text, same as Github)
  2. or `hello` (backtick on 2 sides of hello text)

@melvin-bot melvin-bot bot removed the Overdue label Nov 27, 2023
@hoangzinh
Copy link
Contributor

I've found that there are some differences in inline code block parsing between GitHub and Expensify. I'd like to know what the Expensify rule is based on

@s-alves10 I don't know too. You can ask in Slack to get the answer.

@parasharrajat
Copy link
Member

@hoangzinh Let's think about this problem #31633 (comment) before jumping on proposals.

@hoangzinh
Copy link
Contributor

Oh, I thought we already have unit tests for MD to ensure it won't happen again.

In the past, I raised the same concern and suggested that we should create a ruleset for all MD syntax

@rushatgabhane I wasn't involved before. Could you share more about this point? Thanks

Copy link

melvin-bot bot commented Nov 28, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@twisterdotcom
Copy link
Contributor

FWIW, I think it should render like GitHub: hello .

We are also doing a lot of ExpensiMark updates here: #27977 (comment). Perhaps we should hold Markdown issues on that larger project @parasharrajat / @tomekzaw / @thienlnam?

@tomekzaw
Copy link
Contributor

tomekzaw commented Nov 29, 2023

I believe this issue is related to #31493 but all the other issues in #27977 (comment) seem to be independent.

@thienlnam
Copy link
Contributor

We are also doing a lot of ExpensiMark updates here: #27977 (comment). Perhaps we should hold Markdown issues on that larger project @parasharrajat / @tomekzaw / @thienlnam?

I think we should keep track of all these markdown changes to make sure the expected outcome is correct. Not sure how many of these there are though.

Though since this looks related to #31493, let's just hold this issue on that

@thienlnam thienlnam changed the title [$500] Compose Box - One backtick is outside the code block [HOLD #31493][$500] Compose Box - One backtick is outside the code block Nov 29, 2023
@melvin-bot melvin-bot bot added the Overdue label Feb 13, 2024
@twisterdotcom
Copy link
Contributor

Still waiting on markdown hitting web.

@melvin-bot melvin-bot bot removed the Overdue label Feb 13, 2024
@melvin-bot melvin-bot bot added the Overdue label Feb 22, 2024
@twisterdotcom
Copy link
Contributor

Waiting on #36071 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Feb 22, 2024
@twisterdotcom twisterdotcom changed the title [HOLD #31493][$500] Compose Box - One backtick is outside the code block [HOLD #36071][$500] Compose Box - One backtick is outside the code block Feb 22, 2024
@melvin-bot melvin-bot bot added the Overdue label Mar 4, 2024
@twisterdotcom
Copy link
Contributor

Still going to wait on live markdown being everywhere.

@twisterdotcom
Copy link
Contributor

This is still a weird little thing:
image

image

@melvin-bot melvin-bot bot removed the Overdue label Apr 10, 2024
@twisterdotcom twisterdotcom changed the title [HOLD #36071][$500] Compose Box - One backtick is outside the code block [$250] Code blocks of only spaces don't render Apr 10, 2024
Copy link

melvin-bot bot commented Apr 10, 2024

Upwork job price has been updated to $250

@hoangzinh
Copy link
Contributor

Hi @twisterdotcom is this issue still external or would be picked by @tomekzaw?

@tomekzaw
Copy link
Contributor

tomekzaw commented Apr 13, 2024

@hoangzinh It looks like the root cause of this issue is located in ExpensiMark.

Let's ask @robertKozik from our Live Markdown team at SWM if he wants to come up with a fix or rather make it external.

Copy link

melvin-bot bot commented Apr 17, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@twisterdotcom
Copy link
Contributor

@robertKozik can we assign you or somebody from the Live Markdown team here?

@robertKozik
Copy link
Contributor

Sorry, looking into it right now 👀

@BartoszGrajdek
Copy link
Contributor

BartoszGrajdek commented Apr 22, 2024

Hi! I'm Bartosz from SWM react-native-live-markdown team, I'll be handling this issue together with #39518 you can assign me here 😄

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 22, 2024
Copy link

melvin-bot bot commented Apr 22, 2024

📣 @hoangzinh 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@BartoszGrajdek
Copy link
Contributor

BartoszGrajdek commented May 23, 2024

@thienlnam this issue was due to expensify-common version inconsistency between live markdown & expensify. Can we get it closed since it's now working the same way both in composer & chat?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Monthly KSv2
Projects
No open projects
Archived in project
Development

No branches or pull requests

9 participants