1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-12-18 02:15:56 +01:00

Improved JSON schema

This commit is contained in:
squidfunk 2022-01-30 14:19:35 +01:00
parent e15e426693
commit 9eebd24422
8 changed files with 8948 additions and 80 deletions

View File

@ -103,6 +103,24 @@
"uniqueItems": true, "uniqueItems": true,
"minItems": 1 "minItems": 1
}, },
"strict": {
"title": "Strict mode",
"markdownDescription": "https://www.mkdocs.org/user-guide/configuration/#strict",
"type": "boolean",
"default": false
},
"remote_branch": {
"title": "Remote branch to deploy to",
"markdownDescription": "https://www.mkdocs.org/user-guide/configuration/#remote_branch",
"type": "string",
"default": "gh-pages"
},
"remote_name": {
"title": "Remote origin to deploy to",
"markdownDescription": "https://www.mkdocs.org/user-guide/configuration/#remote_name",
"type": "string",
"default": "origin"
},
"theme": { "theme": {
"$ref": "schema/theme.json" "$ref": "schema/theme.json"
}, },
@ -119,5 +137,19 @@
"$ref": "schema/nav.json" "$ref": "schema/nav.json"
} }
}, },
"additionalProperties": false "additionalProperties": false,
"defaultSnippets": [
{
"label": "site_author",
"body": "${1:Jane Doe}"
},
{
"label": "repo_url",
"body": "repo_url: https://github.com/${1:user}/${2:repo}"
},
{
"label": "copyright",
"body": "copyright: Copyright © 2022 ${1:Jane Doe}"
}
]
} }

View File

@ -2,6 +2,7 @@
"$schema": "https://json-schema.org/draft-07/schema", "$schema": "https://json-schema.org/draft-07/schema",
"title": "Google Fonts", "title": "Google Fonts",
"markdownDescription": "https://fonts.google.com/", "markdownDescription": "https://fonts.google.com/",
"type": "string",
"oneOf": [ "oneOf": [
{ {
"title": "ABeeZee", "title": "ABeeZee",

File diff suppressed because it is too large Load Diff

View File

@ -67,9 +67,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"icon": { "icon": {
"title": "Feedback rating icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#feedback-rating-icon",
"type": "string"
}, },
"name": { "name": {
"title": "Feedback rating name", "title": "Feedback rating name",
@ -107,6 +105,30 @@
"required": [ "required": [
"provider", "provider",
"property" "property"
],
"defaultSnippets": [
{
"label": "feedback",
"body": {
"feedback": {
"title": "${1:Was this page helpful}",
"ratings": [
{
"icon": "${2:material/emoticon-happy-outline}",
"name": "${3:This page was helpful}",
"data": 1,
"note": "${4:Thanks for your feedback!}"
},
{
"icon": "${5:material/emoticon-sad-outline}",
"name": "${6:This page could be improved}",
"data": 0,
"note": "${7:Thanks for your feedback!}"
}
]
}
}
}
] ]
}, },
"consent": { "consent": {
@ -160,7 +182,18 @@
] ]
} }
}, },
"additionalProperties": false "additionalProperties": false,
"defaultSnippets": [
{
"label": "analytics",
"body": {
"analytics": {
"name": "Google Analytics",
"checked": true
}
}
}
]
} }
}, },
"additionalProperties": false, "additionalProperties": false,
@ -178,9 +211,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"icon": { "icon": {
"title": "Social link icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-the-footer/#social-icon",
"type": "string"
}, },
"link": { "link": {
"title": "Social link", "title": "Social link",
@ -259,5 +290,29 @@
"default": true "default": true
} }
}, },
"additionalProperties": false "additionalProperties": false,
"definitions": {
"icon": {
"oneOf": [
{
"$ref": "assets/icons.json"
},
{
"title": "Custom icon",
"type": "string"
}
]
}
},
"defaultSnippets": [
{
"label": "analytics",
"body": {
"analytics": {
"provider": "${1:google}",
"property": "${2:UA-XXXXXXXX-X}"
}
}
}
]
} }

View File

@ -24,14 +24,12 @@
"minify_js": { "minify_js": {
"title": "Minify JavaScript files", "title": "Minify JavaScript files",
"markdownDescription": "https://github.com/byrnereese/mkdocs-minify-plugin#options", "markdownDescription": "https://github.com/byrnereese/mkdocs-minify-plugin#options",
"type": "boolean", "type": "boolean"
"default": true
}, },
"minify_css": { "minify_css": {
"title": "Minify CSS files", "title": "Minify CSS files",
"markdownDescription": "https://github.com/byrnereese/mkdocs-minify-plugin#options", "markdownDescription": "https://github.com/byrnereese/mkdocs-minify-plugin#options",
"type": "boolean", "type": "boolean"
"default": true
}, },
"htmlmin_opts": { "htmlmin_opts": {
"title": "Options for HTML minifier", "title": "Options for HTML minifier",

View File

@ -27,6 +27,20 @@
] ]
} }
}, },
"defaultSnippets": [
{
"label": "Internal redirect",
"body": {
"${1:from}.md": "${2:to}.md"
}
},
{
"label": "External redirect",
"body": {
"${1:from}.md": "https://${2:to.url}"
}
}
],
"additionalProperties": false "additionalProperties": false
} }
}, },

View File

@ -22,7 +22,12 @@
"custom_dir": { "custom_dir": {
"title": "Directory with theme overrides", "title": "Directory with theme overrides",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/customization/#setup-and-theme-structure", "markdownDescription": "https://squidfunk.github.io/mkdocs-material/customization/#setup-and-theme-structure",
"type": "string" "type": "string",
"defaultSnippets": [
{
"body": "${1:overrides}"
}
]
}, },
"static_templates": { "static_templates": {
"title": "Static templates to render", "title": "Static templates to render",
@ -360,12 +365,22 @@
"favicon": { "favicon": {
"title": "Favicon", "title": "Favicon",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-logo-and-icons/#favicon", "markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-logo-and-icons/#favicon",
"pattern": "\\.(ico|png|svg|jpe?g)$" "pattern": "\\.(ico|png|svg|jpe?g)$",
"defaultSnippets": [
{
"body": "${1}.png"
}
]
}, },
"logo": { "logo": {
"title": "Logo", "title": "Logo",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-logo-and-icons/#logo", "markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-logo-and-icons/#logo",
"pattern": "\\.(png|svg|jpe?g)$" "pattern": "\\.(png|svg|jpe?g)$",
"defaultSnippets": [
{
"body": "${1}.png"
}
]
}, },
"icon": { "icon": {
"title": "Icons", "title": "Icons",
@ -373,16 +388,10 @@
"type": "object", "type": "object",
"properties": { "properties": {
"logo": { "logo": {
"title": "Logo icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-logo-and-icons/#logo",
"type": "string",
"default": "material/library"
}, },
"repo": { "repo": {
"title": "Repository icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-logo-and-icons/#logo",
"type": "string",
"default": "fontawesome/brands/git-alt"
}, },
"admonition": { "admonition": {
"title": "Admonition icon", "title": "Admonition icon",
@ -390,81 +399,106 @@
"type": "object", "type": "object",
"properties": { "properties": {
"note": { "note": {
"title": "Admonition note icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/pencil"
}, },
"abstract": { "abstract": {
"title": "Admonition abstract icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/clipboard-text"
}, },
"info": { "info": {
"title": "Admonition info icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/information"
}, },
"tip": { "tip": {
"title": "Admonition tip icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/fire"
}, },
"success": { "success": {
"title": "Admonition success icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/check-bold"
}, },
"question": { "question": {
"title": "Admonition question icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/help-circle"
}, },
"warning": { "warning": {
"title": "Admonition warning icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/alert"
}, },
"failure": { "failure": {
"title": "Admonition failure icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/close-thick"
}, },
"danger": { "danger": {
"title": "Admonition danger icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/lightning-bolt"
}, },
"bug": { "bug": {
"title": "Admonition bug icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/bug"
}, },
"example": { "example": {
"title": "Admonition example icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/format-list-numbered"
}, },
"quote": { "quote": {
"title": "Admonition quote icon", "$ref": "#/definitions/icon"
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonition-icons",
"type": "string",
"default": "material/format-quote-close"
} }
}, },
"additionalProperties": false "additionalProperties": false,
"defaultSnippets": [
{
"label": "note",
"body": "note: ${1:material/pencil}"
},
{
"label": "abstract",
"body": "abstract: ${1:material/clipboard-text}"
},
{
"label": "info",
"body": "info: ${1:material/information}"
},
{
"label": "tip",
"body": "tip: ${1:material/fire}"
},
{
"label": "success",
"body": "success: ${1:material/check-bold}"
},
{
"label": "question",
"body": "question: ${1:material/help-circle}"
},
{
"label": "warning",
"body": "warning: ${1:material/alert}"
},
{
"label": "failure",
"body": "failure: ${1:material/close-thick}"
},
{
"label": "danger",
"body": "danger: ${1:material/lightning-bolt}"
},
{
"label": "bug",
"body": "bug: ${1:material/bug}"
},
{
"label": "example",
"body": "example: ${1:material/format-list-numbered}"
},
{
"label": "quote",
"body": "quote: ${1:material/format-quote-close}"
}
]
} }
} },
"additionalProperties": false,
"defaultSnippets": [
{
"label": "logo",
"body": "logo: ${1:material/library}"
},
{
"label": "repo",
"body": "repo: ${1:fontawesome/brands/git-alt}"
}
]
}, },
"features": { "features": {
"title": "Feature flags", "title": "Feature flags",
@ -474,14 +508,14 @@
"oneOf": [ "oneOf": [
{ {
"title": "Mark as read", "title": "Mark as read",
"markdownDescription": "", "markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-the-header/#mark-as-read",
"enum": [ "enum": [
"announce.dismiss" "announce.dismiss"
] ]
}, },
{ {
"title": "Code annotations", "title": "Code annotations",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-the-header/#mark-as-read", "markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#code-annotations",
"enum": [ "enum": [
"content.code.annotate" "content.code.annotate"
] ]
@ -625,10 +659,11 @@
"$ref": "#/definitions/accent" "$ref": "#/definitions/accent"
}, },
"media": { "media": {
"title": "System preference",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/#system-preference",
"oneOf": [ "oneOf": [
{ {
"title": "System preference",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/#system-preference",
"type": "string",
"enum": [ "enum": [
"\"(prefers-color-scheme: light)\"", "\"(prefers-color-scheme: light)\"",
"\"(prefers-color-scheme: dark)\"" "\"(prefers-color-scheme: dark)\""
@ -637,6 +672,12 @@
{ {
"type": "string" "type": "string"
} }
],
"defaultSnippets": [
{
"label": "\"(prefers-color-scheme: light)\"",
"body": "\"(prefers-color-scheme: ${1:light})\""
}
] ]
}, },
"toggle": { "toggle": {
@ -702,6 +743,14 @@
false false
] ]
} }
],
"defaultSnippets": [
{
"body": {
"text": "${1:Roboto}",
"code": "${2:Roboto Mono}"
}
}
] ]
}, },
"include_search_page": { "include_search_page": {
@ -737,6 +786,12 @@
{ {
"type": "string" "type": "string"
} }
],
"defaultSnippets": [
{
"label": "default",
"body": "${1:default}"
}
] ]
}, },
"primary": { "primary": {
@ -788,10 +843,21 @@
"deep orange", "deep orange",
"brown", "brown",
"grey", "grey",
"blue-grey", "blue grey",
"black", "black",
"white" "white"
] ]
},
"icon": {
"oneOf": [
{
"$ref": "assets/icons.json"
},
{
"title": "Custom icon",
"type": "string"
}
]
} }
} }
} }

View File

@ -297,6 +297,7 @@ const fonts$ = of(Object.keys(fonts))
"$schema": "https://json-schema.org/draft-07/schema", "$schema": "https://json-schema.org/draft-07/schema",
"title": "Google Fonts", "title": "Google Fonts",
"markdownDescription": "https://fonts.google.com/", "markdownDescription": "https://fonts.google.com/",
"type": "string",
"oneOf": items.map(item => ({ "oneOf": items.map(item => ({
"title": item, "title": item,
"markdownDescription": `https://fonts.google.com/specimen/${ "markdownDescription": `https://fonts.google.com/specimen/${
@ -313,8 +314,25 @@ const fonts$ = of(Object.keys(fonts))
)) ))
) )
const icons2$ = icons$
.pipe(
map(icons => ({
"$schema": "https://json-schema.org/draft-07/schema",
"title": "Icon",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/#search",
"type": "string",
"enum": [...icons.values()].map(item => item.replace(".svg", ""))
})),
switchMap(data => write(
"docs/schema/assets/icons.json",
JSON.stringify(data, undefined, 2)
))
)
/* Build schema */ /* Build schema */
const schema$ = merge(fonts$) const schema$ = merge(fonts$, icons2$)
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* Program * Program