App
App copied to clipboard
[$250] Code blocks of only spaces don't render
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:
- Go to any chat
- Send a text wrapped in two spaced backticks(Eg.
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?
- [x] Android: Native
- [x] Android: mWeb Chrome
- [x] iOS: Native
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/594496a1-8de3-460d-ada7-f2ad8051b361
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01369e16f895581dbb
- Upwork Job ID: 1726984904265334784
- Last Price Increase: 2024-04-10
Job added to Upwork: https://www.upwork.com/jobs/~01369e16f895581dbb
Triggered auto assignment to @twisterdotcom (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
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
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (External
)
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|_|)`(.*?\S.*?)`(\B|_|)(?!`|[^<]*<\/pre>)/g,
As you can see, we add negative lookahead assertion ?!`
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|_|)`(.*?\S.*?)`(\B|_|)(?!(\s*`)|[^<]*<\/pre>)/g,
This works as expected
Result
https://github.com/Expensify/App/assets/126839717/edb45571-b261-4998-9ff3-5429974cf2f4
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|_|)`(.*?[\S ].*?)`(\B|_|)(?!`|[^<]*<\/pre>)/g,
https://github.com/Expensify/App/assets/126839717/d5e1e5b5-77b0-4704-8329-a27ac63e9479
Surely this is a regression from somewhere right? cc @parasharrajat or @allroundexperts might know. I feel like we test markdown endlessly.
@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?
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
@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.
@s-alves10 I tried to apply your proposal but it causes a unit test in expensify-common repo failure. Could you check again? Thanks
@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
@twisterdotcom, @hoangzinh Whoops! This issue is 2 days overdue. Let's get this updated quick!
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?
-
- or
`hello`
(backtick on 2 sides of hello text)
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.
@hoangzinh Let's think about this problem https://github.com/Expensify/App/issues/31633#issuecomment-1821775273 before jumping on proposals.
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
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
FWIW, I think it should render like GitHub:
hello
.
We are also doing a lot of ExpensiMark updates here: https://github.com/Expensify/App/issues/27977#issuecomment-1809820659. Perhaps we should hold Markdown issues on that larger project @parasharrajat / @tomekzaw / @thienlnam?
I believe this issue is related to https://github.com/Expensify/App/issues/31493 but all the other issues in https://github.com/Expensify/App/issues/27977#issuecomment-1809820659 seem to be independent.
We are also doing a lot of ExpensiMark updates here: https://github.com/Expensify/App/issues/27977#issuecomment-1809820659. 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 https://github.com/Expensify/App/issues/31493, let's just hold this issue on that
Downgrading to Weekly
Still held on https://github.com/Expensify/App/issues/31493
Still held.
Will test this with new markdown when it hits prod.
Oh, it's still not on web yet: https://expensify.slack.com/archives/C06BDSWLDPB/p1706897366549169.
Making weekly again.
Still waiting on markdown hitting web.
Waiting on https://github.com/Expensify/App/issues/36071#issue-2123827690
Still going to wait on live markdown being everywhere.
This is still a weird little thing:
Upwork job price has been updated to $250