Doctave / doctave

A batteries-included developer documentation site generator
https://cli.doctave.com
MIT License
549 stars 33 forks source link

Make documentation root configurable #20

Closed datdenkikniet closed 2 years ago

datdenkikniet commented 2 years ago

I'd really like for the documentation root to be configurable.

If that's a non-starter, I'd really like for the error messages produced when attempting to find navigation to be refined.

Currently, using this doctave.yaml

---
title: "My Project"

navigation:
  - path: subdir1/
    children: "*"

produces a rather confusing error message (I included the backtrace for good measure).

```bash Doctave | Serve Starting development server... thread 'main' panicked at 'No matching link found', src/navigation.rs:52:26 stack backtrace: 0: rust_begin_unwind at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5 1: core::panicking::panic_fmt at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14 2: core::option::expect_failed at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/option.rs:1615:5 3: core::option::Option::expect at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/option.rs:698:21 4: doctave::navigation::Navigation::customize at /home/jona/projects/doctave/src/navigation.rs:50:42 5: doctave::navigation::Navigation::build_for at /home/jona/projects/doctave/src/navigation.rs:23:26 6: doctave::site_generator::SiteGenerator::run at /home/jona/projects/doctave/src/site_generator.rs:45:26 7: ::build at /home/jona/projects/doctave/src/site.rs:115:9 8: doctave::serve::ServeCommand::run at /home/jona/projects/doctave/src/serve.rs:37:9 9: doctave::serve at /home/jona/projects/doctave/src/main.rs:102:5 10: doctave::main at /home/jona/projects/doctave/src/main.rs:52:33 11: core::ops::function::FnOnce::call_once at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. ```

Since it's not possible to change the documentation root, I cannot compile the documentation, even with an (effectively useless) README.md present in the docs subdirectory.

datdenkikniet commented 2 years ago

I created a PR that adds this functionality, plus the possibility of specifying the document root in doctave init, see #21