@@ -516,7 +516,7 @@ window['PR']
516516 if ( ! isPreformatted ) {
517517 text = text . replace ( / [ \t \r \n ] + / g, ' ' ) ;
518518 } else {
519- text = text . replace ( / \r \n ? / g, '\n' ) ; // Normalize newlines.
519+ text = text . replace ( / \r \n ? / g, '\r\ n' ) ; // Normalize newlines.
520520 }
521521 // TODO: handle tabs here?
522522 chunks [ k ] = text ;
@@ -531,11 +531,12 @@ window['PR']
531531 walk ( node ) ;
532532
533533 return {
534- source : chunks . join ( '' ) . replace ( / \n $ / , '' ) ,
534+ source : chunks . join ( '' ) . replace ( / \r \ n$ / , '' ) ,
535535 spans : spans
536536 } ;
537537 }
538538
539+
539540 /**
540541 * Apply the given language handler to sourceCode and add the resulting
541542 * decorations to out.
@@ -853,7 +854,7 @@ window['PR']
853854 /**
854855 * Given a DOM subtree, wraps it in a list, and puts each line into its own
855856 * list item.
856- *
857+ *
857858 * @param {Node } node modified in place. Its content is pulled into an
858859 * HTMLOListElement, and each line is moved into a separate list item.
859860 * This requires cloning elements, so the input might not have unique
@@ -940,7 +941,9 @@ window['PR']
940941 var parent = limit . parentNode ;
941942 if ( parent ) {
942943 // We clone the parent chain.
943- // This helps us resurrect important
944+ // This helps us resurrect important styling elements that cross lines.
945+ // E.g. in <i>Foo<br>Bar</i>
946+ // should be rewritten to <li><i>Foo</i></li><li><i>Bar</i></li>.
944947 var parentClone = breakLeftOf ( parent , 1 ) ;
945948 // Move the clone and everything to the right of the original
946949 // onto the cloned parent.
0 commit comments