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

Add support for inline code with space only character as content #797

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

tsa321
Copy link
Contributor

@tsa321 tsa321 commented Sep 9, 2024

Fixed Issues

$ Expensify/App#48101

Tests

  1. What unit/integration tests cover your change? What autoQA tests cover your change?
    I have add unit tests for this issue.
  2. What tests did you perform that validates your changed worked?
    Update the related regex in the expensify-common in node module and send the test messages from composer of the App.
    Test example:
` `

Must be displayed as:




Another test : ` ` must be displayed as :

QA

  1. What does QA need to do to validate your changes?
    Same as test above

  2. What areas to they need to test for regressions?
    Inline code and code fence related tests.

Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@tsa321 tsa321 requested a review from a team as a code owner September 9, 2024 01:39
@melvin-bot melvin-bot bot requested review from jasperhuangg and removed request for a team September 9, 2024 01:39
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
@tsa321
Copy link
Contributor Author

tsa321 commented Sep 9, 2024

cc @hoangzinh

// must be present inside the backticks.
regex: /(\B|_|)&#x60;((?:&#x60;)*(?!&#x60;).*?[\S| |\u00A0]+?.*?(?<!&#x60;)(?:&#x60;)*)&#x60;(\B|_|)(?!&#x60;|[^<]*<\/pre>|[^<]*<\/video>)/gm,
replacement: (_extras, _match, g1, g2, g3) => {
return `${g1}<code>${g2.replaceAll(' ', '&nbsp;')}</code>${g3}`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we only replace string with HTML encoding when a g2 contains only whitespaces? Any thoughts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was thinking about it as well. I will modify the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoangzinh I have modified the code.

Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
Copy link

@hoangzinh hoangzinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested in Expensify App

Screenshot 2024-09-10 at 22 01 47

@hoangzinh
Copy link

cc @deetergp all yours

@deetergp deetergp self-requested a review September 10, 2024 18:14
@deetergp
Copy link
Contributor

Code looks good and tests well 👍

@deetergp deetergp merged commit f3cc9a2 into Expensify:main Sep 10, 2024
6 checks passed
Copy link

🚀Published to npm in v2.0.88

// must be present inside the backticks.
regex: /(\B|_|)&#x60;((?:&#x60;)*(?!&#x60;).*?[\S| |\u00A0]+?.*?(?<!&#x60;)(?:&#x60;)*)&#x60;(\B|_|)(?!&#x60;|[^<]*<\/pre>|[^<]*<\/video>)/gm,
replacement: (_extras, _match, g1, g2, g3) => {
const g2Value = g2.trim() === '' ? g2.replaceAll(' ', '&nbsp;') : g2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are partly related to this issue

More details here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants