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    /// The path to source code (e.g. `tree/main/packages/contracts`).
24    /// Useful for monorepos or for projects with source code located in specific directories.
25    #[serde(default, skip_serializing_if = "Option::is_none")]
26    pub path: Option<String>,
27    /// Globs to ignore
28    pub ignore: Vec<String>,
29}
30
31impl Default for DocConfig {
32    fn default() -> Self {
33        Self {
34            out: PathBuf::from("docs"),
35            book: PathBuf::from("book.toml"),
36            homepage: Some(PathBuf::from("README.md")),
37            title: String::default(),
38            repository: None,
39            path: None,
40            ignore: Vec::default(),
41        }
42    }
43}