From bd24aca8374d2a3e044bafa5add857c6ac6efb8a Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sun, 30 Jan 2022 09:46:43 +0100 Subject: [PATCH] Added documentation on using schema validation --- docs/creating-your-site.md | 35 +++++++++++++++++++++++++++++++++++ mkdocs.yml | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/creating-your-site.md b/docs/creating-your-site.md index 0cdd15de5..e87bfd2b8 100644 --- a/docs/creating-your-site.md +++ b/docs/creating-your-site.md @@ -92,6 +92,41 @@ slightly different: [mkdocs_theme.yml]: https://github.com/squidfunk/mkdocs-material/blob/master/src/mkdocs_theme.yml [custom theme guide]: https://www.mkdocs.org/user-guide/custom-themes/#creating-a-custom-theme +??? tip "Recommended: configuration validation and auto-complete" + + In order to minimize friction and maximize productivity, Material for MkDocs + provides its own [schema.json] for `mkdocs.yml`. If your editor supports + YAML schema validation, it's definitely recommdended to set it up: + + === "Visual Studio Code" + + 1. Install [`vscode-yaml`][vscode-yaml] for YAML language support. + 2. Add the schema under the `yaml.schemas` key in your user or + workspace [`settings.json`][settings.json]: + + ``` json + { + "yaml.schemas": { + "https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml" + } + } + ``` + + === "Other" + + 1. Ensure your editor of choice has support for YAML schema validation. + 2. Add the following lines at the top of `mkdocs.yml`: + + ``` yaml + # yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json + ``` + + + [schema.json]: schema.json + [vscode-yaml]: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml + [settings.json]: https://code.visualstudio.com/docs/getstarted/settings + [LSP-yaml]: https://github.com/sublimelsp/LSP-yaml + ### Advanced configuration Material for MkDocs comes with many configuration options. The setup section diff --git a/mkdocs.yml b/mkdocs.yml index 3ea5fc85a..c5824d143 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -158,7 +158,7 @@ markdown_extensions: # Page tree nav: - - Home: index.mds + - Home: index.md - Getting started: - Installation: getting-started.md - Creating your site: creating-your-site.md