From 27a1e7c3eea7d9ca212f1e82cae37d5424303bce Mon Sep 17 00:00:00 2001 From: Alexander Voss Date: Thu, 5 Oct 2023 13:16:54 -0400 Subject: [PATCH] Added new MkDocs 1.5 settings to JSON schema * added support for two new entries in mkdocs.yml `exclude_docs` and `not_in_nav` were introduced in MkDocs Version 1.5 * added support for the validation field * using $defs, supporting simplified form, no additional props - this should support the forms of definitions described in the manual https://www.mkdocs.org/user-guide/configuration/#validation including uses with `nav` and `link` sections as well as without - making use of a `$defs` section to avoid too much duplication - added `"additionalProperties": false` * moved `additionalProperties` for consistency with style --- docs/schema.json | 13 +++++++++ docs/schema/validation.json | 53 +++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 docs/schema/validation.json diff --git a/docs/schema.json b/docs/schema.json index f1677d463..b8d51395f 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -154,6 +154,19 @@ "nav": { "$ref": "schema/nav.json" }, + "validation": { + "$ref": "schema/validation.json" + }, + "exclude_docs": { + "title": "Pattern to declare files to exclude from build", + "markdownDescription": "https://www.mkdocs.org/user-guide/configuration/#exclude_docs", + "type": "string" + }, + "not_in_nav": { + "title": "Pattern to declare pages that do not appear in the navigation", + "markdownDescription": "https://www.mkdocs.org/user-guide/configuration/#not_in_nav", + "type": "string" + }, "watch": { "items": { "title": "Path to watch for changes", diff --git a/docs/schema/validation.json b/docs/schema/validation.json new file mode 100644 index 000000000..a309c6c4a --- /dev/null +++ b/docs/schema/validation.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema", + "title": "Validation settings", + "markdownDescription": "https://www.mkdocs.org/user-guide/configuration/#validation", + "type": "object", + "properties": { + "omitted_files": { "$ref": "#/$defs/omitted_files" }, + "not_found": { "$ref": "#/$defs/not_found" }, + "absolute_links": { "$ref": "#/$defs/absolute_links" }, + "nav": { + "title": "validation of navigation", + "markdownDescription": "https://www.mkdocs.org/user-guide/configuration/#validation", + "properties": { + "omitted_files": { "$ref": "#/$defs/omitted_files" }, + "not_found": { "$ref": "#/$defs/not_found" }, + "absolute_links": { "$ref": "#/$defs/absolute_links" } + }, + "additionalProperties": false + }, + "links": { + "title": "Validation of links", + "markdownDescription": "https://www.mkdocs.org/user-guide/configuration/#validation", + "properties": { + "not_found": { "$ref": "#/$defs/not_found" }, + "absolute_links": { "$ref": "#/$defs/absolute_links" }, + "unrecognized_links": { "$ref": "#/$defs/unrecognized_links" } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "$defs": { + "omitted_files": { + "title": "warning level when files exist but are not referenced in navigation", + "$ref": "#/$defs/warning_levels" + }, + "not_found": { + "title": "warning level when file referenced is not found or is excluded", + "$ref": "#/$defs/warning_levels" + }, + "absolute_links": { + "title": "warning level when absolute links are used", + "$ref": "#/$defs/warning_levels" + }, + "unrecognized_links": { + "title": "warning level when a relative link cannot be resolved to a document", + "$ref": "#/$defs/warning_levels" + }, + "warning_levels": { + "enum": ["warn", "info", "ignore"] + } + } +}