1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-23 23:21:00 +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,
"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": {
"$ref": "schema/theme.json"
},
@ -119,5 +137,19 @@
"$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",
"title": "Google Fonts",
"markdownDescription": "https://fonts.google.com/",
"type": "string",
"oneOf": [
{
"title": "ABeeZee",

File diff suppressed because it is too large Load Diff

View File

@ -67,9 +67,7 @@
"type": "object",
"properties": {
"icon": {
"title": "Feedback rating icon",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#feedback-rating-icon",
"type": "string"
"$ref": "#/definitions/icon"
},
"name": {
"title": "Feedback rating name",
@ -107,6 +105,30 @@
"required": [
"provider",
"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": {
@ -160,7 +182,18 @@
]
}
},
"additionalProperties": false
"additionalProperties": false,
"defaultSnippets": [
{
"label": "analytics",
"body": {
"analytics": {
"name": "Google Analytics",
"checked": true
}
}
}
]
}
},
"additionalProperties": false,
@ -178,9 +211,7 @@
"type": "object",
"properties": {
"icon": {
"title": "Social link icon",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-the-footer/#social-icon",
"type": "string"
"$ref": "#/definitions/icon"
},
"link": {
"title": "Social link",
@ -259,5 +290,29 @@
"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": {
"title": "Minify JavaScript files",
"markdownDescription": "https://github.com/byrnereese/mkdocs-minify-plugin#options",
"type": "boolean",
"default": true
"type": "boolean"
},
"minify_css": {
"title": "Minify CSS files",
"markdownDescription": "https://github.com/byrnereese/mkdocs-minify-plugin#options",
"type": "boolean",
"default": true
"type": "boolean"
},
"htmlmin_opts": {
"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
}
},

View File

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