@@ -53,6 +53,7 @@ class GoogleDocument {
5353 let text = el . textRun . content
5454 . replace ( / \n $ / , "" ) // Remove new lines
5555 . replace ( / “ | ” / g, '"' ) // Replace smart quotes by double quotes
56+ . replace ( / \u000b / g, "<br/>" ) // Replace soft lines breaks, vertical tabs
5657 const contentMatch = text . match ( / ^ ( \s * ) ( \S + (?: [ \t \v ] * \S + ) * ) ( \s * ) $ / ) // Match "text", "before" and "after"
5758
5859 if ( contentMatch ) {
@@ -211,7 +212,6 @@ class GoogleDocument {
211212 return content
212213 . map ( ( { paragraph} ) => paragraph . elements . map ( this . formatText ) . join ( "" ) )
213214 . join ( "" )
214- . replace ( / \n / g, "<br/>" ) // Replace newline characters by <br/> to avoid multi-paragraphs
215215 }
216216
217217 indentText ( text , level ) {
@@ -408,10 +408,10 @@ class GoogleDocument {
408408 . map ( ( { paragraph} ) =>
409409 paragraph . elements . map ( ( el ) => el . textRun . content ) . join ( "" )
410410 )
411- . join ( "" )
412- . replace ( / \x0B / g, "\n" ) //eslint-disable-line no-control-regex
413- . replace ( / ^ \n | \n $ / g, "" )
414- . split ( "\n" )
411+ . join ( "" ) // Transform to string
412+ . replace ( / \x0B / g, "\n" ) // Replace vertical tabs
413+ . replace ( / ^ \n | \n $ / g, "" ) // Remove new lines characters at the beginning and end of line
414+ . split ( "\n" ) // Transform to array
415415
416416 // "".split() -> [""]
417417 if ( codeContent . length === 1 && codeContent [ 0 ] === "" ) return
0 commit comments