UNPKG

@codedoc/core

Version:

Create beautiful modern documentation websites.

68 lines (62 loc) 2.32 kB
export function Fonts(options, renderer) { if (!options) options = {}; if (!options.text) options.text = { name: 'Hind', url: 'https://fonts.googleapis.com/css?family=Hind:400,700&display=swap', }; if (!options.text.fallback) options.text.fallback = 'sans-serif'; if (!options.code) options.code = { name: 'Source Code Pro', url: 'https://fonts.googleapis.com/css?family=Source+Code+Pro:300,400&display=swap', }; if (!options.code.fallback) options.code.fallback = `'Courier New', Courier, monospace`; if (!options.icon) options.icon = { name: 'Material Icons', url: 'https://fonts.googleapis.com/icon?family=Material+Icons%7CMaterial+Icons+Outlined&display=swap' }; if (!options.icon.outline) options.icon.outline = options.icon.name + ' Outlined'; return renderer.create("fragment", null, renderer.create("link", { href: options.text.url, rel: "stylesheet" }), renderer.create("link", { href: options.code.url, rel: "stylesheet" }), renderer.create("link", { href: options.icon.url, rel: "stylesheet" }), renderer.create("style", null, ` body, input, button { font-family: '${options.text.name}', ${options.text.fallback}; } code, .hljs { font-family: '${options.code.name}', ${options.code.fallback}; } .icon-font { font-family: '${options.icon.name}'; font-weight: normal; font-style: normal; font-size: 24px; /* Preferred icon size */ display: inline-block; line-height: 1; text-transform: none; letter-spacing: normal; word-wrap: normal; white-space: nowrap; direction: ltr; /* Support for all WebKit browsers. */ -webkit-font-smoothing: antialiased; /* Support for Safari and Chrome. */ text-rendering: optimizeLegibility; /* Support for Firefox. */ -moz-osx-font-smoothing: grayscale; /* Support for IE. */ font-feature-settings: 'liga'; } .icon-font.outline { font-family: '${options.icon.outline}'; } `)); } //# sourceMappingURL=fonts.js.map