-
Notifications
You must be signed in to change notification settings - Fork 136
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
Preserve code fence line breaks and ensure backticks occupy a separate line #496
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
@marcochavezf This PR is a part of the App PR which requires changes in the ExpensifyMark (expensify-common). Also tagging @bondydaa. |
@@ -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 = '>This is a *quote* that started on a new line.\nHere is a >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 >quote that did not <pre>here is a codefenced quote<br />>it should not be quoted</pre>'; | |||
const quoteTestReplacedString = '<blockquote>This is a <strong>quote</strong> that started on a new line.</blockquote>Here is a >quote that did not <pre>here is a codefenced quote<br />>it should not be quoted<br /></pre>'; |
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.
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.
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.
@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.
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.
@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.
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.
I've elaborated here Expensify/App#14694 (comment) on the changes
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.
and here Expensify/App#14694 (comment)
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.
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
Fixed Issues
$ Expensify/App#14694
Tests
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 inExpensiMark-Markdown-test.js
, which validates the behavior described in the test, which was not covered by existing tests.QA
Steps (validation + regressions)
text
once added.text
:New.Expensify.-.Google.Chrome.2023-02-02.20-08-04.mp4