@@ -8,15 +8,10 @@ use std::{
8
8
use anyhow:: Error ;
9
9
use log:: warn;
10
10
use path_slash:: PathExt ;
11
- use percent_encoding:: { NON_ALPHANUMERIC , utf8_percent_encode} ;
12
11
use walkdir:: WalkDir ;
13
12
14
13
use crate :: Config ;
15
14
16
- fn url_encode ( input : & str ) -> String {
17
- utf8_percent_encode ( input, NON_ALPHANUMERIC ) . to_string ( )
18
- }
19
-
20
15
/// Representation of an mdbook src directory entry
21
16
/// This may be a folder or a .md file
22
17
#[ derive( Debug , Clone ) ]
@@ -180,19 +175,14 @@ impl Display for DocFolder {
180
175
let index = self . path . join ( & self . index ) ;
181
176
// If this is the src folder
182
177
if self . depth == 0 {
183
- writeln ! (
184
- f,
185
- "[{}]({})" ,
186
- self . title,
187
- url_encode( index. to_slash_lossy( ) . as_ref( ) )
188
- ) ?;
178
+ writeln ! ( f, "[{}](<{}>)" , self . title, index. to_slash_lossy( ) . as_ref( ) ) ?;
189
179
} else {
190
180
writeln ! (
191
181
f,
192
- "{}- [{}]({} )" ,
182
+ "{}- [{}](<{}> )" ,
193
183
" " . repeat( ( ( self . depth - 1 ) as usize ) * 2 ) ,
194
184
self . title,
195
- url_encode ( index. to_slash_lossy( ) . as_ref( ) )
185
+ index. to_slash_lossy( ) . as_ref( )
196
186
) ?;
197
187
}
198
188
@@ -292,18 +282,18 @@ impl Display for DocFile {
292
282
if self . depth == 0 || self . depth == 1 {
293
283
return writeln ! (
294
284
f,
295
- "[{}]({} )" ,
285
+ "[{}](<{}> )" ,
296
286
self . title,
297
- url_encode ( self . path. to_slash_lossy( ) . as_ref( ) )
287
+ self . path. to_slash_lossy( ) . as_ref( )
298
288
) ;
299
289
}
300
290
301
291
writeln ! (
302
292
f,
303
- "{}- [{}]({} )" ,
293
+ "{}- [{}](<{}> )" ,
304
294
" " . repeat( ( ( self . depth - 1 ) as usize ) * 2 ) ,
305
295
self . title,
306
- url_encode ( self . path. to_slash_lossy( ) . as_ref( ) )
296
+ self . path. to_slash_lossy( ) . as_ref( )
307
297
)
308
298
}
309
299
}
0 commit comments