foundry_config/
doc.rs

1//! Configuration specific to the `forge doc` command and the `forge_doc` package
2
3use serde::{Deserialize, Serialize};
4use std::path::PathBuf;
5
6/// Contains the config for parsing and rendering docs
7#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
8pub struct DocConfig {
9    /// Doc output path.
10    pub out: PathBuf,
11    /// The documentation title.
12    pub title: String,
13    /// Path to user provided `book.toml`.
14    pub book: PathBuf,
15    /// Path to user provided welcome markdown.
16    ///
17    /// If none is provided, it defaults to `README.md`.
18    #[serde(default, skip_serializing_if = "Option::is_none")]
19    pub homepage: Option<PathBuf>,
20    /// The repository url.
21    #[serde(default, skip_serializing_if = "Option::is_none")]
22    pub repository: Option<String>,
23    /// Globs to ignore
24    pub ignore: Vec<String>,
25}
26
27impl Default for DocConfig {
28    fn default() -> Self {
29        Self {
30            out: PathBuf::from("docs"),
31            book: PathBuf::from("book.toml"),
32            homepage: Some(PathBuf::from("README.md")),
33            title: String::default(),
34            repository: None,
35            ignore: Vec::default(),
36        }
37    }
38}