-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
fix: replace all escaped \n
with an actual \n
character
#14454
Conversation
Codecov ReportBase: 57.47% // Head: 57.47% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #14454 +/- ##
=======================================
Coverage 57.47% 57.47%
=======================================
Files 1263 1263
Lines 30775 30775
Branches 5772 5772
=======================================
Hits 17689 17689
Misses 11253 11253
Partials 1833 1833
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
mmh so codemirror
automatically escaping any \
by replacing it with \\
but then we reverse it for preview with markdown it
? 👀
works well though well done!
It seems to be when the value is part of an action dispatched that it's serialized along the way & then it's put in the store, but the same is to be said when we get the default value from the API response on initial launch, CodeMirror doesn't really do much in this case I believe. |
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.
LGTM - nice catch 💃
What does it do?
When our objects are stringified they're parsed so the
\n
becomes\\n
, which means when it's parsed, it's no longer recognised as a line-break character, instead it's recognised as a\
andn
separately. This PR replaces those string sections, with the line-break character again.Why is it needed?
IMO it's a little confusing because
\n
isn't strictly markdown and if people use<br>
instead, everything works fine. But this solution does solve the issue brought up by the community.How to test it?
hello\nthere
This will also work if you type out line breaks in the editor itself.
Related issue(s)/PR(s)