@@ -78,6 +78,16 @@ export function correctTranslatedContentStrings(
7878 // measured across all eight translated languages.
7979 content = joinDanglingMarkers ( content )
8080
81+ // YAML `|2-` block-scalar artifacts: some translated frontmatter fields
82+ // (typically `intro`) arrive with a spurious leading newline followed by
83+ // deep indentation when the translator wrote `field: |2-\n\n content`.
84+ // The YAML parser preserves the leading blank line and extra indentation
85+ // in the parsed string. Strip that leading whitespace when the English
86+ // source has no such prefix.
87+ if ( content . startsWith ( '\n' ) && ! englishContent . startsWith ( '\n' ) ) {
88+ content = content . replace ( / ^ \n [ \t ] * / , '' )
89+ }
90+
8191 // --- Per-language fixes (es, ja, pt, zh, ru, fr, ko, de) ---
8292
8393 if ( context . code === 'es' ) {
@@ -2173,17 +2183,35 @@ function joinDanglingMarkers(content: string): string {
21732183 }
21742184 const nextContent = nextDeep [ 1 ]
21752185
2186+ // Consume additional deeply-indented continuation lines so multi-line
2187+ // wrapped headings/blockquotes/bold-opens collapse onto one line
2188+ // (e.g. `##\n {%if%}\n content`). Returns the concatenated
2189+ // continuation text and the new line index.
2190+ const consumeContinuations = ( start : number ) : { extra : string ; nextI : number } => {
2191+ let extra = ''
2192+ let j = start
2193+ while ( j + 1 < lines . length ) {
2194+ const cont = lines [ j + 1 ] . match ( deepIndented )
2195+ if ( ! cont ) break
2196+ extra += cont [ 1 ]
2197+ j ++
2198+ }
2199+ return { extra, nextI : j }
2200+ }
2201+
21762202 const heading = line . match ( headingOnly )
21772203 if ( heading ) {
2178- out . push ( `${ heading [ 1 ] } ${ heading [ 2 ] } ${ nextContent } ` )
2179- i ++
2204+ const { extra, nextI } = consumeContinuations ( i + 1 )
2205+ out . push ( `${ heading [ 1 ] } ${ heading [ 2 ] } ${ nextContent } ${ extra } ` )
2206+ i = nextI
21802207 continue
21812208 }
21822209
21832210 const bq = line . match ( blockquoteOnly )
21842211 if ( bq ) {
2185- out . push ( `${ bq [ 1 ] } ${ nextContent } ` )
2186- i ++
2212+ const { extra, nextI } = consumeContinuations ( i + 1 )
2213+ out . push ( `${ bq [ 1 ] } ${ nextContent } ${ extra } ` )
2214+ i = nextI
21872215 continue
21882216 }
21892217
@@ -2196,8 +2224,9 @@ function joinDanglingMarkers(content: string): string {
21962224
21972225 const boldOpen = line . match ( markerThenBoldOnly )
21982226 if ( boldOpen ) {
2199- out . push ( `${ boldOpen [ 1 ] } **${ nextContent } ` )
2200- i ++
2227+ const { extra, nextI } = consumeContinuations ( i + 1 )
2228+ out . push ( `${ boldOpen [ 1 ] } **${ nextContent } ${ extra } ` )
2229+ i = nextI
22012230 continue
22022231 }
22032232
0 commit comments