@@ -27,12 +27,10 @@ function raise(issue, snippet = '') {
27
27
return null ;
28
28
}
29
29
30
- const crlfRegex = / \r \n / gm;
31
30
const propertyRegex = / ^ \s + ( [ a - z A - Z ] + ) : \s * ( .+ ) / ;
32
- const headerEndCodeStartRegex = / ^ \s * - - - \s * ` ` ` .* \n / ;
31
+ const headerEndCodeStartRegex = / ^ \s * - - - \s * ` ` ` .* \r ? \ n/ ;
33
32
const codeRegex = / ^ ( .+ ) ` ` ` / s
34
33
function parseSnippet ( path , name , text ) {
35
- if ( crlfRegex . exec ( text ) !== null ) return raise ( 'Found CRLF line endings instead of LF line endings' , path ) ;
36
34
let cursor = 0 ;
37
35
38
36
const fromCursor = ( ) => text . substring ( cursor ) ;
@@ -68,7 +66,7 @@ function parseSnippet(path, name, text) {
68
66
author : properties . author ,
69
67
tags : properties . tags . split ( ',' ) . map ( ( tag ) => tag . trim ( ) ) . filter ( ( tag ) => tag ) ,
70
68
contributors : 'contributors' in properties ? properties . contributors . split ( ',' ) . map ( ( contributor ) => contributor . trim ( ) ) . filter ( ( contributor ) => contributor ) : [ ] ,
71
- code : code ,
69
+ code : code . replace ( / \r \n / g , '\n' ) ,
72
70
}
73
71
}
74
72
0 commit comments