@@ -203,42 +203,28 @@ export function parseCommentString(
203203 // Check for frontmatter
204204 let frontmatterData : Record < string , unknown > = { } ;
205205 const firstBlock = content [ 0 ] ;
206-
207- let lineBreak : string ;
208- switch ( firstBlock . text . startsWith ( "---\r\n" ) ) {
209- case true :
210- lineBreak = "\r\n" ;
211- break ;
212- case false :
213- lineBreak = "\n" ;
214- break ;
215- }
216-
217- if ( firstBlock . text . startsWith ( `---${ lineBreak } ` ) ) {
218- const end = firstBlock . text . indexOf ( `${ lineBreak } ---${ lineBreak } ` ) ;
206+ if ( firstBlock . text . startsWith ( "---\n" ) ) {
207+ const end = firstBlock . text . indexOf ( "\n---\n" ) ;
219208 if ( end !== - 1 ) {
220- const yamlText = firstBlock . text . slice (
221- `---${ lineBreak } ` . length ,
222- end ,
223- ) ;
209+ const yamlText = firstBlock . text . slice ( "---\n" . length , end ) ;
224210 firstBlock . text = firstBlock . text
225- . slice ( end + ` ${ lineBreak } ---${ lineBreak } ` . length )
211+ . slice ( end + "\n ---\n" . length )
226212 . trimStart ( ) ;
227213
228214 const frontmatter = parseYamlDoc ( yamlText , { prettyErrors : false } ) ;
229215 for ( const warning of frontmatter . warnings ) {
230216 // Can't translate issues coming from external library...
231217 logger . warn (
232218 warning . message as TranslatedString ,
233- warning . pos [ 0 ] + ` ---${ lineBreak } ` . length ,
219+ warning . pos [ 0 ] + " ---\n" . length ,
234220 file ,
235221 ) ;
236222 }
237223 for ( const error of frontmatter . errors ) {
238224 // Can't translate issues coming from external library...
239225 logger . error (
240226 error . message as TranslatedString ,
241- error . pos [ 0 ] + ` ---${ lineBreak } ` . length ,
227+ error . pos [ 0 ] + " ---\n" . length ,
242228 file ,
243229 ) ;
244230 }
0 commit comments