File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,20 @@ function ( $matches ) use ( $replacement_string ) {
161
161
$ text
162
162
);
163
163
164
+ // Insert a newline when \n follows `.`.
165
+ $ text = preg_replace (
166
+ "/\.[ \n\r]+(?!\s*[ \n\r])/m " ,
167
+ '.<br> ' ,
168
+ $ text
169
+ );
170
+
171
+ // Insert a new line when \n is followed by what appears to be a list.
172
+ $ text = preg_replace (
173
+ "/[ \n\r]+(\s+[*-] )(?!\s*[ \n\r])/m " ,
174
+ '<br>$1 ' ,
175
+ $ text
176
+ );
177
+
164
178
// Merge consecutive non-blank lines together by replacing the newlines with a space.
165
179
$ text = preg_replace (
166
180
"/[ \n\r](?!\s*[ \n\r])/m " ,
@@ -406,5 +420,8 @@ function format_description( $description ) {
406
420
$ parsedown = \Parsedown::instance ();
407
421
$ description = $ parsedown ->line ( $ description );
408
422
}
423
+
424
+ $ description = fix_newlines ( $ description );
425
+
409
426
return $ description ;
410
427
}
You can’t perform that action at this time.
0 commit comments