Skip to content

Commit bd24aca

Browse files
committed
Added documentation on using schema validation
1 parent b874786 commit bd24aca

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

docs/creating-your-site.md

+35
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,41 @@ slightly different:
9292
[mkdocs_theme.yml]: https://github.com/squidfunk/mkdocs-material/blob/master/src/mkdocs_theme.yml
9393
[custom theme guide]: https://www.mkdocs.org/user-guide/custom-themes/#creating-a-custom-theme
9494

95+
??? tip "Recommended: configuration validation and auto-complete"
96+
97+
In order to minimize friction and maximize productivity, Material for MkDocs
98+
provides its own [schema.json] for `mkdocs.yml`. If your editor supports
99+
YAML schema validation, it's definitely recommdended to set it up:
100+
101+
=== "Visual Studio Code"
102+
103+
1. Install [`vscode-yaml`][vscode-yaml] for YAML language support.
104+
2. Add the schema under the `yaml.schemas` key in your user or
105+
workspace [`settings.json`][settings.json]:
106+
107+
``` json
108+
{
109+
"yaml.schemas": {
110+
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
111+
}
112+
}
113+
```
114+
115+
=== "Other"
116+
117+
1. Ensure your editor of choice has support for YAML schema validation.
118+
2. Add the following lines at the top of `mkdocs.yml`:
119+
120+
``` yaml
121+
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json
122+
```
123+
124+
125+
[schema.json]: schema.json
126+
[vscode-yaml]: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
127+
[settings.json]: https://code.visualstudio.com/docs/getstarted/settings
128+
[LSP-yaml]: https://github.com/sublimelsp/LSP-yaml
129+
95130
### Advanced configuration
96131

97132
Material for MkDocs comes with many configuration options. The setup section

mkdocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ markdown_extensions:
158158

159159
# Page tree
160160
nav:
161-
- Home: index.mds
161+
- Home: index.md
162162
- Getting started:
163163
- Installation: getting-started.md
164164
- Creating your site: creating-your-site.md

0 commit comments

Comments
 (0)