Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/config/src/config/markup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub enum HighlightConfig {
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Highlighting {
/// Emit an error for missing highlight languages. Defaults to false
#[serde(default)]
Expand Down
16 changes: 16 additions & 0 deletions components/config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,22 @@ base_url = "https://replace-this-with-your-url.com"
assert!(config.is_err());
}

#[test]
fn errors_when_unknown_highlighting_field() {
let config = r#"
title = "My site"
base_url = "https://replace-this-with-your-url.com"

[markdown.highlighting]
theme = "base16-ocean-dark"
extra_grammar = ["static/grammar/pillar.json"]
"#;

let config = Config::parse(config);
assert!(config.is_err());
assert!(config.unwrap_err().to_string().contains("extra_grammar"));
}

#[test]
fn errors_when_missing_required_field() {
// base_url is required
Expand Down