diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs index 6d8a06167d..0b66f9d4e5 100644 --- a/src/cmd/serve.rs +++ b/src/cmd/serve.rs @@ -43,6 +43,15 @@ pub fn make_subcommand() -> Command { .value_parser(NonEmptyStringValueParser::new()) .help("Port to use for HTTP connections"), ) + .arg( + Arg::new("renderer") + .short('r') + .long("renderer") + .num_args(1) + .default_value("html") + .value_parser(NonEmptyStringValueParser::new()) + .help("Renderer to serve the output of"), + ) .arg_open() .arg_watcher() } @@ -54,6 +63,7 @@ pub fn execute(args: &ArgMatches) -> Result<()> { let port = args.get_one::("port").unwrap(); let hostname = args.get_one::("hostname").unwrap(); + let renderer = args.get_one::("renderer").unwrap(); let open_browser = args.get_flag("open"); let address = format!("{hostname}:{port}"); @@ -73,7 +83,7 @@ pub fn execute(args: &ArgMatches) -> Result<()> { .to_socket_addrs()? .next() .ok_or_else(|| anyhow::anyhow!("no address found for {}", address))?; - let build_dir = book.build_dir_for("html"); + let build_dir = book.build_dir_for(renderer); let html_config = book.config.html_config(); let input_404 = html_config.and_then(|c| c.input_404); let file_404 = get_404_output_file(&input_404);