mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-27 17:00:54 +01:00
Added Google Fonts to JSON schema
This commit is contained in:
parent
0bdd8365d2
commit
715a939e94
7049
docs/schema/assets/fonts.json
Normal file
7049
docs/schema/assets/fonts.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -43,10 +43,7 @@
|
||||
]
|
||||
},
|
||||
"cards_font": {
|
||||
"title": "Social card font",
|
||||
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-social-cards/#cards-font",
|
||||
"type": "string",
|
||||
"default": "Roboto"
|
||||
"$ref": "../assets/fonts.json"
|
||||
},
|
||||
"cards_directory": {
|
||||
"title": "Social card directory",
|
||||
|
@ -603,16 +603,10 @@
|
||||
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-fonts/",
|
||||
"properties": {
|
||||
"text": {
|
||||
"title": "Regular font",
|
||||
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-fonts/#regular-font",
|
||||
"type": "string",
|
||||
"default": "Roboto"
|
||||
"$ref": "assets/fonts.json"
|
||||
},
|
||||
"code": {
|
||||
"title": "Monospaced font",
|
||||
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/changing-the-fonts/#monospaced-font",
|
||||
"type": "string",
|
||||
"default": "Roboto Mono"
|
||||
"$ref": "assets/fonts.json"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
|
27
package-lock.json
generated
27
package-lock.json
generated
@ -3862,6 +3862,33 @@
|
||||
"delegate": "^3.1.2"
|
||||
}
|
||||
},
|
||||
"google-fonts-complete": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/google-fonts-complete/-/google-fonts-complete-2.1.1.tgz",
|
||||
"integrity": "sha512-6e7jXyadmW4iHrrmYitcsoyVpcymjndBsgXLeo0XXXbAqU9xhM06OxxJAiPqSrp9Xn2bvBueOTe091lwkKVc1g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"postcss": "^7.0.18"
|
||||
},
|
||||
"dependencies": {
|
||||
"picocolors": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz",
|
||||
"integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==",
|
||||
"dev": true
|
||||
},
|
||||
"postcss": {
|
||||
"version": "7.0.39",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.39.tgz",
|
||||
"integrity": "sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"picocolors": "^0.2.1",
|
||||
"source-map": "^0.6.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"got": {
|
||||
"version": "9.6.0",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
|
||||
|
@ -75,6 +75,7 @@
|
||||
"eslint-plugin-no-null": "^1.0.2",
|
||||
"github-types": "^1.0.0",
|
||||
"gitlab": "^14.2.2",
|
||||
"google-fonts-complete": "^2.1.1",
|
||||
"html-minifier": "^4.0.0",
|
||||
"material-design-color": "^2.3.2",
|
||||
"material-shadows": "^3.0.1",
|
||||
|
@ -20,6 +20,7 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import fonts from "google-fonts-complete"
|
||||
import { minify as minhtml } from "html-minifier"
|
||||
import * as path from "path"
|
||||
import {
|
||||
@ -287,6 +288,34 @@ const index$ = zip(icons$, emojis$)
|
||||
))
|
||||
)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Compute font schema */
|
||||
const fonts$ = of(Object.keys(fonts))
|
||||
.pipe(
|
||||
map(items => ({
|
||||
"$schema": "https://json-schema.org/draft-07/schema",
|
||||
"title": "Google Fonts",
|
||||
"markdownDescription": "https://fonts.google.com/",
|
||||
"oneOf": items.map(item => ({
|
||||
"title": item,
|
||||
"markdownDescription": `https://fonts.google.com/specimen/${
|
||||
item.replace(/\s+/g, "+")
|
||||
}`,
|
||||
"enum": [
|
||||
item
|
||||
],
|
||||
}))
|
||||
})),
|
||||
switchMap(data => write(
|
||||
"docs/schema/assets/fonts.json",
|
||||
JSON.stringify(data, undefined, 2)
|
||||
))
|
||||
)
|
||||
|
||||
/* Build schema */
|
||||
const schema$ = merge(fonts$)
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Program
|
||||
* ------------------------------------------------------------------------- */
|
||||
@ -295,7 +324,7 @@ const index$ = zip(icons$, emojis$)
|
||||
const build$ =
|
||||
process.argv.includes("--dirty")
|
||||
? templates$
|
||||
: concat(assets$, merge(templates$, index$))
|
||||
: concat(assets$, merge(templates$, index$, schema$))
|
||||
|
||||
/* Let's get rolling */
|
||||
build$.subscribe()
|
||||
|
30
typings/google-fonts/index.d.ts
vendored
Normal file
30
typings/google-fonts/index.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2022 Martin Donath <martin.donath@squidfunk.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Global types
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
declare module "google-fonts-complete" {
|
||||
const fonts: Record<string, unknown>
|
||||
export default fonts
|
||||
}
|
Loading…
Reference in New Issue
Block a user