-
-
Notifications
You must be signed in to change notification settings - Fork 99
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(forums): normalize newlines from synthetic events #3083
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,11 @@ const createPatterns = (type: string) => [ | |
]; | ||
|
||
export function preProcessShortcodesInBody(body: string): string { | ||
let result = body; | ||
// First, normalize any escaped newlines back to actual newlines. | ||
let result = body.replace(/↵\n/g, '\n'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A unicode character for escaping a newline? I've never seen that before. Should you use an escape sequence for it ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No harm in adding an escape sequence. Updated in latest - I'll go ahead and merge so the changes in this branch can safely land in #3074. |
||
|
||
// Then, normalize any remaining line endings. | ||
result = result.replace(/\r\n|\r|\n/g, '\n'); | ||
|
||
for (const { type, shortcode } of shortcodeTypes) { | ||
const patterns = createPatterns(type); | ||
|
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 applied the
mb-3
to the #3074 PR (for both this and ShortcodeQuotes). You should remove it from here to eliminate the merge conflict (I've touched this code for trimming the leading<br>
).