File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -299,8 +299,13 @@ impl MDBook {
299
299
300
300
pub fn read_config ( mut self ) -> Result < Self > {
301
301
let config_path = self . root . join ( "book.toml" ) ;
302
- debug ! ( "[*] Loading the config from {}" , config_path. display( ) ) ;
303
- self . config = Config :: from_disk ( & config_path) ?;
302
+
303
+ if config_path. exists ( ) {
304
+ debug ! ( "[*] Loading the config from {}" , config_path. display( ) ) ;
305
+ self . config = Config :: from_disk ( & config_path) ?;
306
+ } else {
307
+ self . config = Config :: default ( ) ;
308
+ }
304
309
305
310
Ok ( self )
306
311
}
Original file line number Diff line number Diff line change @@ -51,3 +51,14 @@ fn run_mdbook_init_with_custom_book_and_src_locations() {
51
51
assert ! ( target. exists( ) , "{} should have been created by `mdbook init`" , file) ;
52
52
}
53
53
}
54
+
55
+ #[ test]
56
+ fn book_toml_isnt_required ( ) {
57
+ let temp = TempDir :: new ( "mdbook" ) . unwrap ( ) ;
58
+ let mut md = MDBook :: new ( temp. path ( ) ) ;
59
+ md. init ( ) . unwrap ( ) ;
60
+
61
+ assert ! ( !temp. path( ) . join( "book.toml" ) . exists( ) ) ;
62
+
63
+ md. read_config ( ) . unwrap ( ) . build ( ) . unwrap ( ) ;
64
+ }
You can’t perform that action at this time.
0 commit comments