@@ -5,6 +5,7 @@ use clap::Arg;
5
5
use deno_doc:: find_nodes_by_name_recursively;
6
6
use deno_doc:: html:: HrefResolver ;
7
7
use deno_doc:: html:: ShortPath ;
8
+ use deno_doc:: html:: UrlResolveKind ;
8
9
use deno_doc:: DocNodeKind ;
9
10
use deno_doc:: DocParser ;
10
11
use deno_doc:: DocParserOptions ;
@@ -54,7 +55,7 @@ async fn run() -> anyhow::Result<()> {
54
55
. arg (
55
56
Arg :: with_name ( "html" )
56
57
. long ( "html" )
57
- . requires_all ( & [ "name" , " output"] ) ,
58
+ . requires_all ( & [ "output" ] ) ,
58
59
)
59
60
. arg ( Arg :: with_name ( "name" ) . long ( "name" ) . takes_value ( true ) )
60
61
. arg (
@@ -74,9 +75,9 @@ async fn run() -> anyhow::Result<()> {
74
75
let source_files = matches. values_of ( "source_files" ) . unwrap ( ) ;
75
76
let html = matches. is_present ( "html" ) ;
76
77
let name = if html {
77
- matches. value_of ( "name" ) . unwrap ( ) . to_string ( )
78
+ matches. value_of ( "name" ) . map ( |name| name . to_string ( ) )
78
79
} else {
79
- "" . to_string ( )
80
+ None
80
81
} ;
81
82
let main_entrypoint = if html {
82
83
matches. value_of ( "main_entrypoint" ) . map ( |main_entrypoint| {
@@ -174,6 +175,14 @@ fn main() {
174
175
struct EmptyResolver ( ) ;
175
176
176
177
impl HrefResolver for EmptyResolver {
178
+ fn resolve_path (
179
+ & self ,
180
+ current : UrlResolveKind ,
181
+ target : UrlResolveKind ,
182
+ ) -> String {
183
+ deno_doc:: html:: href_path_resolve ( current, target)
184
+ }
185
+
177
186
fn resolve_global_symbol ( & self , _symbol : & [ String ] ) -> Option < String > {
178
187
None
179
188
}
@@ -200,7 +209,7 @@ impl HrefResolver for EmptyResolver {
200
209
}
201
210
202
211
fn generate_docs_directory (
203
- name : String ,
212
+ package_name : Option < String > ,
204
213
output_dir : String ,
205
214
main_entrypoint : Option < ModuleSpecifier > ,
206
215
doc_nodes_by_url : IndexMap < ModuleSpecifier , Vec < deno_doc:: DocNode > > ,
@@ -214,15 +223,14 @@ fn generate_docs_directory(
214
223
}
215
224
216
225
let options = deno_doc:: html:: GenerateOptions {
217
- package_name : Some ( name ) ,
226
+ package_name,
218
227
main_entrypoint,
219
228
href_resolver : Rc :: new ( EmptyResolver ( ) ) ,
220
229
usage_composer : None ,
221
230
rewrite_map : Some ( index_map) ,
222
- hide_module_doc_title : false ,
223
- sidebar_flatten_namespaces : false ,
231
+ composable_output : true ,
224
232
} ;
225
- let html = deno_doc:: html:: generate ( options. clone ( ) , doc_nodes_by_url) ?;
233
+ let html = deno_doc:: html:: generate ( options, doc_nodes_by_url) ?;
226
234
227
235
let path = & output_dir_resolved;
228
236
let _ = std:: fs:: remove_dir_all ( path) ;
0 commit comments