Skip to content

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

Merged
deetergp merged 3 commits into
Expensify:mainfrom
tsa321:blankInlineCode
Sep 10, 2024
Merged

deetergp merged 3 commits into
Expensify:mainfrom
tsa321:blankInlineCode

Conversation

@tsa321

@tsa321 tsa321 commented Sep 9, 2024

Copy link
Copy Markdown
Contributor

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

tsa321 commented Sep 9, 2024

Copy link
Copy Markdown
Contributor Author

cc @hoangzinh

Comment thread lib/ExpensiMark.ts Outdated
// 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}`;

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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>
@tsa321
tsa321 requested a review from hoangzinh September 10, 2024 00:31

@hoangzinh hoangzinh left a comment

Copy link
Copy Markdown

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
Copy Markdown

cc @deetergp all yours

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

Copy link
Copy Markdown
Contributor

Code looks good and tests well 👍

@deetergp
deetergp merged commit f3cc9a2 into Expensify:main Sep 10, 2024
@github-actions

Copy link
Copy Markdown

🚀Published to npm in v2.0.88

Comment thread lib/ExpensiMark.ts
// 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
Copy Markdown
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