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 block markdown renders incorrectly #53573

Open
1 of 8 tasks
m-natarajan opened this issue Dec 4, 2024 · 24 comments
Open
1 of 8 tasks

[$250] Code block markdown renders incorrectly #53573

m-natarajan opened this issue Dec 4, 2024 · 24 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Overdue

Comments

@m-natarajan
Copy link

m-natarajan commented Dec 4, 2024

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: 9.0.71-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @MonilBhavsar
Slack conversation (hyperlinked to channel name): expensify_bugs

Action Performed:

  1. In any chat, type the following message - "hello `` hi`" (remove double quotes)
  2. Send the message

Expected Result:

Message composed as hello `` hi`

Actual Result:

Message composed as hello `` hi`

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Snip - New Expensify - Google Chrome

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021866767677427055045
  • Upwork Job ID: 1866767677427055045
  • Last Price Increase: 2024-12-11
  • Automatic offers:
    • QichenZhu | Contributor | 105481643
Issue OwnerCurrent Issue Owner: @allroundexperts
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 4, 2024
Copy link

melvin-bot bot commented Dec 4, 2024

Triggered auto assignment to @JmillsExpensify (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.

@melvin-bot melvin-bot bot added the Overdue label Dec 9, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

@JmillsExpensify Eep! 4 days overdue now. Issues have feelings too...

@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

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

@melvin-bot melvin-bot bot changed the title Code block markdown renders incorrectly [$250] Code block markdown renders incorrectly Dec 11, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

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

@JmillsExpensify
Copy link

This isn't really related to convert/migrate/retain so I added it to quality.

@QichenZhu
Copy link
Contributor

Proposal

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

Markdown doesn't currently support empty code blocks.

What is the root cause of that problem?

The user expects double backticks in the middle itself to be an empty code block. This is also mentioned in this comment.

`hello` `` hi`

However, the current regex doesn't allow this and requires inline code blocks to contain at least one non-whitespace character, a space, or a no-break space.

https://github.com/Expensify/expensify-common/blob/6611dab75bcbf6ec5950401990299f883536a6c0/lib/ExpensiMark.ts#L230

Screenshot 2024-12-12 at 1 59 43 PM

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

Now that we allow spaces as content, there's no need to disallow empty content, as it's confusing for both users and developers. I suggest simplifying the regex.

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

Resolving this issue will also unblock #52780 (comment).

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

New test case to add

Test string: "`hello` `` hi`"
Expected result: "<code>hello</code> <code></code> hi&#x60;"

Existing test cases to update

Test inline code blocks with double backticks
Expected result before: "My favorite language is <code>&#x60;JavaScript&#x60;</code>. How about you?"
Expected result after: "My favorite language is <code></code>JavaScript<code></code>. How about you?"
Test inline code blocks with triple backticks
Expected result before: "My favorite language is <code>&#x60;&#x60;JavaScript&#x60;&#x60;</code>. How about you?"
Expected result after: "My favorite language is <code></code><code>JavaScript</code><code></code>. How about you?"
Test inline code with one backtick as content
Expected result before: "&#x60;&#x60;&#x60;"
Expected result after: "<code></code>&#x60;"
Test inline code with multiple backtick symbols as content
Expected result before: "&#x60;&#x60;&#x60;&#x60;&#x60;&#x60;"
Expected result after: "<code></code><code></code><code></code>"
Test inline code blocks with two backticks
Expected result before: "<code>&#x60;JavaScript&#x60;</code>"
Expected result after: "<code></code>JavaScript<code></code>"
Test for backticks only tab characters inside it
Expected result before: "&#x60;	&#x60;"
Expected result after: "<code>	</code>"
Test for inline code block with triple backtick with spaces as content
Expected result before: "<code>&#x60;&#x60;   &#x60;&#x60;</code>"
Expected result after: "<code></code><code>&nbsp;&nbsp;&nbsp;</code><code></code>"

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Dec 16, 2024

@JmillsExpensify, @allroundexperts Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Dec 16, 2024
@allroundexperts
Copy link
Contributor

@QichenZhu's proposal looks good to me. I am pretty confident that if all our existing unit tests on regex pass after this change, we won't introduce any regression.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 16, 2024

Triggered auto assignment to @jasperhuangg, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Dec 18, 2024

@JmillsExpensify @allroundexperts @jasperhuangg 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!

Copy link

melvin-bot bot commented Dec 20, 2024

@JmillsExpensify, @allroundexperts, @jasperhuangg Whoops! This issue is 2 days overdue. Let's get this updated quick!

@allroundexperts
Copy link
Contributor

@jasperhuangg Kind bump

@melvin-bot melvin-bot bot removed the Overdue label Dec 23, 2024
Copy link

melvin-bot bot commented Dec 27, 2024

@JmillsExpensify, @allroundexperts, @jasperhuangg Whoops! This issue is 2 days overdue. Let's get this updated quick!

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

melvin-bot bot commented Dec 27, 2024

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

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot removed the Overdue label Dec 27, 2024
Copy link

melvin-bot bot commented Dec 30, 2024

@JmillsExpensify, @allroundexperts, @jasperhuangg, @QichenZhu Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@QichenZhu
Copy link
Contributor

QichenZhu commented Dec 30, 2024

Not overdue. PR is under review.

Copy link

melvin-bot bot commented Dec 31, 2024

@JmillsExpensify, @allroundexperts, @jasperhuangg, @QichenZhu Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Jan 1, 2025

@JmillsExpensify @allroundexperts @jasperhuangg @QichenZhu this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@QichenZhu
Copy link
Contributor

There is already a PR upgrading expensify-common: #54685.

@allgandalf
Copy link
Contributor

@allroundexperts are you going to bump the dependancy version with this issue ?

@allroundexperts
Copy link
Contributor

@allgandalf #53573 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Jan 2, 2025
Copy link

melvin-bot bot commented Jan 7, 2025

@JmillsExpensify, @allroundexperts, @jasperhuangg, @QichenZhu Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Jan 7, 2025
Copy link

melvin-bot bot commented Jan 9, 2025

@JmillsExpensify, @allroundexperts, @jasperhuangg, @QichenZhu 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@QichenZhu
Copy link
Contributor

Update: #54685 has been merged, and I verified it fixed this issue.

Screenshots/Videos

Android: Native
android-native.mp4
Android: mWeb Chrome
android-web.mp4
iOS: Native
ios-native.mp4
iOS: mWeb Safari
ios-web.mp4
MacOS: Chrome / Safari
mac-web.mov
MacOS: Desktop
mac-desktop.mp4

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Overdue
Projects
Development

No branches or pull requests

6 participants