Prevent parsing backticks if are only content of inline code block #628
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modifies the replacement function for inline code blocks. Now, the function checks if the content consists only of backtick symbols. If yes, the unmodified match string is returned; otherwise, the behavior should remain unchanged.
I opted to implement this check within the replacement function rather than inside the already established regex. This decision was made because incorporating this check inside the regex was challenging without introducing regressions (especially with the
``` ```
string). Moreover, splitting it should be beneficial for code readability.Fixed Issues
$ Expensify/App#31493
Tests
two unit test are added to the test suite to cover prime examples of this issue:
```
and``````
which should ensure that no matter how long is the sequence of backticks, as long as they are only symbols inside the content it will not parseRun all unit tests and cross-check inside newDot
QA
Testing is quite straight forward. Inside newDot chat any sequence of backticks (wihtout any other char) shouldn't be parsed (fe.
```````
or```````````
)Since this PR only modifies the ExpensiMark part responsible for parsing inline code blocks, any regressions might occur while users are typing such markdown. To ensure that no regressions are introduced, besides unit tests, existing regression tests involving inline code blocks can be rerun.