@@ -10,22 +10,17 @@ var dest = args[1] || src
10
10
fs . readFile ( src , 'utf8' , function ( err , data ) {
11
11
if ( err ) return console . log ( err )
12
12
13
- var fileExt = src . split ( '.' ) . pop ( )
14
13
var result = data . replace ( / @ V E R S I O N @ / g, npm . version )
14
+ . replace ( / - - - ( [ \s \S ] + ) - - - / g, '' )
15
+ . replace ( / ( n p m - ) ? ( [ a - z A - Z \\ . - ] * ) \( 1 \) / g, 'npm help $2' )
16
+ . replace ( / ( n p m - ) ? ( [ a - z A - Z \\ . - ] * ) \( ( 5 | 7 ) \) / g, 'npm help $2' )
17
+ . replace ( / n p m ( 1 ) / g, 'npm help npm' )
18
+ . replace ( / \[ ( [ ^ \] ] + ) \] \( \/ c l i - c o m m a n d s \/ ( [ ^ ) ] + ) \) / g, 'npm help $2' )
19
+ . replace ( / \[ ( [ ^ \] ] + ) \] \( \/ c o n f i g u r i n g - n p m \/ ( [ ^ ) ] + ) \) / g, 'npm help $2' )
20
+ . replace ( / \[ ( [ ^ \] ] + ) \] \( \/ u s i n g - n p m \/ ( [ ^ ) ] + ) \) / g, 'npm help $2' )
21
+ . trim ( )
15
22
16
- if ( fileExt === 'md' ) {
17
- result = marked (
18
- result . replace ( / - - - ( [ \s \S ] + ) - - - / g, '' )
19
- . replace ( / ( n p m - ) ? ( [ a - z A - Z \\ . - ] * ) \( 1 \) / g, 'npm help $2' )
20
- . replace ( / ( n p m - ) ? ( [ a - z A - Z \\ . - ] * ) \( ( 5 | 7 ) \) / g, 'npm help $2' )
21
- . replace ( / ( n p m - ) ? ( [ a - z A - Z \\ . - ] * ) \( 3 \) / g, 'npm apihelp $2' )
22
- . replace ( / n p m ( 1 ) / g, 'npm help npm' )
23
- . replace ( / n p m ( 3 ) / g, 'npm apihelp npm' )
24
- . trim ( )
25
- )
26
- }
27
-
28
- fs . writeFile ( dest , result , 'utf8' , function ( err ) {
23
+ fs . writeFile ( dest , marked ( result ) , 'utf8' , function ( err ) {
29
24
if ( err ) return console . log ( err )
30
25
} )
31
26
} )
0 commit comments