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

Preserve code fence line breaks and ensure backticks occupy a separate line #496

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

marktoman
Copy link
Contributor

Fixed Issues

$ Expensify/App#14694

Tests

  1. What unit/integration tests cover your change? What autoQA tests cover your change?
  2. What tests did you perform that validates your changed worked?

The change updates the tests in ExpensiMark-HTML-test.js, which depended on the previous incorrect behavior (i.e., the line break was always stripped). It also introduces a new test in ExpensiMark-Markdown-test.js, which validates the behavior described in the test, which was not covered by existing tests.

QA

  1. What does QA need to do to validate your changes?
  2. What areas to they need to test for regressions?

Steps (validation + regressions)

  1. Add a comment:
```
text

```
  1. Verify that it has an empty line below text once added.
  2. Edit it and check that it looks the same as 1.
  3. Repeat 1-3 for the below, but instead, make sure that it has no added line below text:
```
text
```
New.Expensify.-.Google.Chrome.2023-02-02.20-08-04.mp4

@marktoman marktoman requested a review from a team as a code owner February 2, 2023 19:25
@github-actions
Copy link

github-actions bot commented Feb 2, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@melvin-bot melvin-bot bot requested review from marcochavezf and removed request for a team February 2, 2023 19:26
@marktoman
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@marktoman
Copy link
Contributor Author

recheck

@mananjadhav
Copy link
Contributor

@marcochavezf This PR is a part of the App PR which requires changes in the ExpensifyMark (expensify-common).

Also tagging @bondydaa.

@bondydaa bondydaa self-requested a review February 2, 2023 22:14
@@ -24,7 +24,7 @@ test('Test multi-line bold markdown replacement', () => {
// Sections starting with > are successfully wrapped with <blockquote></blockquote>
test('Test quote markdown replacement', () => {
const quoteTestStartString = '&gt;This is a *quote* that started on a new line.\nHere is a &gt;quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```';
const quoteTestReplacedString = '<blockquote>This is a <strong>quote</strong> that started on a new line.</blockquote>Here is a &gt;quote that did not <pre>here&#32;is&#32;a&#32;codefenced&#32;quote<br />&gt;it&#32;should&#32;not&#32;be&#32;quoted</pre>';
const quoteTestReplacedString = '<blockquote>This is a <strong>quote</strong> that started on a new line.</blockquote>Here is a &gt;quote that did not <pre>here&#32;is&#32;a&#32;codefenced&#32;quote<br />&gt;it&#32;should&#32;not&#32;be&#32;quoted<br /></pre>';
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm having to add all of these makes me question if we might have purposefully been removing new lines at the end of codefences.

Going to double check this real quick.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bondydaa I think it should not strip the line when doing this conversion, because the context is not known. By that I don't suggest that it should strip it when adding the comment either, given that is the reported issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bondydaa One possible purpose that comes to mind is the HTML to MD conversion, which always added a new line. This has been fixed as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've elaborated here Expensify/App#14694 (comment) on the changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@bondydaa bondydaa left a comment

Choose a reason for hiding this comment

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

Approving for now since I'm on board with the change. I think we hold until tomorrow (I'm in Mountain Time US) pending the discussion I brought up in slack, if no one objects then we'll merge

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.

3 participants