-
Notifications
You must be signed in to change notification settings - Fork 135
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
Conversation
Signed-off-by: Tsaqif <tsaiinkwa@yahoo.com>
cc @hoangzinh |
lib/ExpensiMark.ts
Outdated
// must be present inside the backticks. | ||
regex: /(\B|_|)`((?:`)*(?!`).*?[\S| |\u00A0]+?.*?(?<!`)(?:`)*)`(\B|_|)(?!`|[^<]*<\/pre>|[^<]*<\/video>)/gm, | ||
replacement: (_extras, _match, g1, g2, g3) => { | ||
return `${g1}<code>${g2.replaceAll(' ', ' ')}</code>${g3}`; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @deetergp all yours |
Code looks good and tests well 👍 |
🚀Published to npm in v2.0.88 |
// must be present inside the backticks. | ||
regex: /(\B|_|)`((?:`)*(?!`).*?[\S| |\u00A0]+?.*?(?<!`)(?:`)*)`(\B|_|)(?!`|[^<]*<\/pre>|[^<]*<\/video>)/gm, | ||
replacement: (_extras, _match, g1, g2, g3) => { | ||
const g2Value = g2.trim() === '' ? g2.replaceAll(' ', ' ') : g2; |
There was a problem hiding this comment.
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
Fixed Issues
$ Expensify/App#48101
Tests
I have add unit tests for this issue.
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
What does QA need to do to validate your changes?
Same as test above
What areas to they need to test for regressions?
Inline code and code fence related tests.