Skip to content

fix: fail build on invalid HTML renderer config#3097

Closed
leno23 wants to merge 1 commit into
rust-lang:masterfrom
leno23:fix/validate-html-config-2984
Closed

fix: fail build on invalid HTML renderer config#3097
leno23 wants to merge 1 commit into
rust-lang:masterfrom
leno23:fix/validate-html-config-2984

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

Fixes #2984.

Config::html_config() previously logged deserialization errors and returned None, which caused mdBook to fall back to default HTML settings and continue the build. Invalid [output.html] keys (e.g. foo = 123) now propagate as errors and fail the build, consistent with other config validation.

Changes

  • Make html_config() return Result<Option<HtmlConfig>> by delegating to get("output.html")
  • Update call sites (serve, watch, HTML renderer, theme_dir, etc.) to propagate errors
  • Add unit and integration tests for unknown [output.html] fields

Test plan

  • cargo test -p mdbook-core html_config_rejects
  • cargo test bad_config_in_html_table
  • cargo test -p mdbook-core -p mdbook-driver
  • CI (awaiting)

Made with Cursor

Propagate deserialization errors from `Config::html_config()` instead of
logging and returning `None`, so unknown `[output.html]` keys cause the
build to fail. Fixes rust-lang#2984.

Co-authored-by: Cursor <cursoragent@cursor.com>
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label May 17, 2026
@ehuss ehuss closed this May 23, 2026
@rustbot rustbot removed the S-waiting-on-review Status: waiting on a review label May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate html config

3 participants