fonts: remove KaTeX & Jost completely, replace with Inter

This commit is contained in:
Martin Allien
2021-06-18 11:34:57 +02:00
parent e67b52462a
commit cedd53de9f
94 changed files with 80 additions and 1367 deletions

134
README.md
View File

@@ -2,6 +2,18 @@
> [doc.kerberos.io](https://doc.kerberos.io)
## Development
Install dependencies
$ yarn install
Run Hugo dev server with autocompile of assets
$ yarn start
## TODO
- config/_default/params.toml
@@ -10,125 +22,3 @@
- before launch
- [ ] change baseURL in config/production/config.toml
---
<p align="center">
<a href="https://getdoks.org/">
<img alt="Doks" src="https://doks.netlify.app/doks.svg" width="60">
</a>
</p>
<h1 align="center">
Doks
</h1>
<h3 align="center">
Modern documentation theme
</h3>
<p align="center">
Doks is a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default.
</p>
<p align="center">
<a href="https://github.com/h-enk/doks/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/h-enk/doks?style=flat-square" alt="GitHub">
</a>
<a href="https://github.com/h-enk/doks/releases">
<img src="https://img.shields.io/github/v/release/h-enk/doks?include_prereleases&style=flat-square"alt="GitHub release (latest SemVer including pre-releases)">
</a>
<a href="https://github.com/h-enk/doks/actions?query=workflow%3A%22Hyas+CI%22">
<img src="https://img.shields.io/github/workflow/status/h-enk/doks/Hyas%20CI/master?style=flat-square" alt="GitHub Workflow Status (branch)">
</a>
<a href="https://app.netlify.com/sites/doks/deploys">
<img src="https://img.shields.io/netlify/895a161c-86be-48a2-8c57-a8c5d68cd1a4?style=flat-square" alt="Netlify">
</a>
</p>
![Doks — Modern Documentation Theme](https://raw.githubusercontent.com/h-enk/doks/master/images/tn.png)
## Demo
- [doks.netlify.app](https://doks.netlify.app/)
## Why Doks?
Nine reasons why you should use Doks:
1. __Security aware__. Get A+ scores on [Mozilla Observatory](https://observatory.mozilla.org/analyze/doks.netlify.app) out of the box. Easily change the default Security Headers to suit your needs.
2. __Fast by default__. Get 100 scores on [Google Lighthouse](https://googlechrome.github.io/lighthouse/viewer/?gist=7731347bb8ce999eff7428a8e763b637) by default. Doks removes unused css, prefetches links, and lazy loads images.
3. __SEO-ready__. Use sensible defaults for structured data, open graph, and Twitter cards. Or easily change the SEO settings to your liking.
4. __Development tools__. Code with confidence. Check styles, scripts, and markdown for errors and fix automatically or manually.
5. __Bootstrap framework__. Build robust, flexible, and intuitive websites with Bootstrap 5. Easily customize your Doks site with the source Sass files.
6. __Netlify-ready__. Deploy to Netlify with sensible defaults. Easily use Netlify Functions, Netlify Redirects, and Netlify Headers.
7. __Full text search__. Search your Doks site with FlexSearch. Easily customize index settings and search options to your liking.
8. __Page layouts__. Build pages with a landing page, blog, or documentation layout. Add custom sections and components to suit your needs.
9. __Dark mode__. Switch to a low-light UI with the click of a button. Change colors with variables to match your branding.
## Requirements
Doks uses npm to centralize dependency management, making it [easy to update](https://getdoks.org/docs/help/how-to-update/) resources, build tooling, plugins, and build scripts:
- Download and install [Node.js](https://nodejs.org/) (it includes npm) for your platform.
## Get started
Start a new Doks project in three steps:
### 1. Create a new site
Doks is available as a child theme, and a starter theme:
- Use the Doks child theme, if you do __not__ plan to customize a lot, and/or need future Doks updates.
- Use the Doks starter theme, if you plan to customize a lot, and/or do __not__ need future Doks updates.
Not quite sure? Use the Doks child theme.
#### Doks child theme
```bash
git clone https://github.com/h-enk/doks-child-theme.git my-doks-site && cd my-doks-site
```
#### Doks starter theme
```bash
git clone https://github.com/h-enk/doks.git my-doks-site && cd my-doks-site
```
### 2. Install dependencies
```bash
npm install
```
### 3. Start development server
```bash
npm run start
```
## Other commands
Doks comes with [commands](https://getdoks.org/docs/prologue/commands/) for common tasks.
## Documentation
- [Netlify](https://docs.netlify.com/)
- [Hugo](https://gohugo.io/documentation/)
- [Doks](https://getdoks.org/)
## Communities
- [Netlify Community](https://community.netlify.com/)
- [Hugo Forums](https://discourse.gohugo.io/)
- [Doks Discussions](https://github.com/h-enk/doks/discussions)

View File

@@ -1,10 +0,0 @@
document.addEventListener('DOMContentLoaded', function() {
renderMathInElement(document.body, {
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true},
],
});
});

View File

@@ -10,9 +10,6 @@
/** Import highlight.js */
// @import "highlight.js/scss/dracula";
/** Import KaTeX */
@import "katex/dist/katex";
/** Import theme styles */
@import "common/fonts";
@import "common/global";

View File

@@ -1,71 +1,52 @@
/* jost-regular - latin */
/*
Self-hosted fonts
*/
@font-face {
font-family: "Jost";
font-style: normal;
font-family: 'Inter';
font-style: normal;
font-weight: 400;
font-display: swap;
src:
local("Jost"),
url("fonts/vendor/jost/jost-v4-latin-regular.woff2") format("woff2"),
url("fonts/vendor/jost/jost-v4-latin-regular.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
src: url("fonts/Inter-Regular.woff2?v=3.18") format("woff2"),
url("fonts/Inter-Regular.woff?v=3.18") format("woff");
}
/* jost-500 - latin */
@font-face {
font-family: "Jost";
font-style: normal;
font-family: 'Inter';
font-style: normal;
font-weight: 500;
font-display: swap;
src:
local("Jost"),
url("fonts/vendor/jost/jost-v4-latin-500.woff2") format("woff2"),
url("fonts/vendor/jost/jost-v4-latin-500.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
src: url("fonts/Inter-Medium.woff2?v=3.18") format("woff2"),
url("fonts/Inter-Medium.woff?v=3.18") format("woff");
}
/* jost-700 - latin */
@font-face {
font-family: "Jost";
font-family: 'Inter';
font-style: normal;
font-weight: 600;
font-display: swap;
src: url("fonts/Inter-SemiBold.woff2?v=3.18") format("woff2"),
url("fonts/Inter-SemiBold.woff?v=3.18") format("woff");
}
/* -------------------------------------------------------
Variable font.
Usage:
body {
font-family: 'Inter', sans-serif; // use regular Inter font by default..
@supports (font-variation-settings: normal) {
font-family: 'Inter var', sans-serif; // ..but if supported, use variable Inter font instead (all-in-one)
}
}
*/
@font-face {
font-family: 'Inter var';
font-weight: 100 900;
font-display: swap;
font-style: normal;
font-weight: 700;
font-display: swap;
src:
local("Jost"),
url("fonts/vendor/jost/jost-v4-latin-700.woff2") format("woff2"),
url("fonts/vendor/jost/jost-v4-latin-700.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* jost-italic - latin */
@font-face {
font-family: "Jost";
font-style: italic;
font-weight: 400;
font-display: swap;
src:
local("Jost"),
url("fonts/vendor/jost/jost-v4-latin-italic.woff2") format("woff2"),
url("fonts/vendor/jost/jost-v4-latin-italic.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* jost-500italic - latin */
@font-face {
font-family: "Jost";
font-style: italic;
font-weight: 500;
font-display: swap;
src:
local("Jost"),
url("fonts/vendor/jost/jost-v4-latin-500italic.woff2") format("woff2"),
url("fonts/vendor/jost/jost-v4-latin-500italic.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* jost-700italic - latin */
@font-face {
font-family: "Jost";
font-style: italic;
font-weight: 700;
font-display: swap;
src:
local("Jost"),
url("fonts/vendor/jost/jost-v4-latin-700italic.woff2") format("woff2"),
url("fonts/vendor/jost/jost-v4-latin-700italic.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
font-named-instance: 'Regular';
src: url("fonts/Inter-roman.var.woff2?v=3.18") format("woff2");
}

View File

@@ -223,7 +223,3 @@ body {
-webkit-text-fill-color: transparent;
-moz-text-fill-color: transparent;
}
.katex {
font-size: $font-size-md;
}

View File

@@ -86,6 +86,3 @@ rel = "sitemap"
[[module.mounts]]
source = "node_modules/flexsearch"
target = "assets/js/vendor/flexsearch"
[[module.mounts]]
source = "node_modules/katex"
target = "assets/js/vendor/katex"

View File

@@ -55,4 +55,3 @@ editPage = true
bootStrapJs = false
breadCrumb = false
highLight = true
kaTex = false

View File

@@ -23,7 +23,6 @@ module.exports = {
'./assets/scss/components/_code.scss',
'./assets/scss/components/_search.scss',
'./assets/scss/common/_dark.scss',
'./node_modules/katex/dist/katex.css',
]),
],
}),

View File

@@ -6,9 +6,6 @@
{{ $highlight := resources.Get "js/highlight.js" -}}
{{ $highlight := $highlight | js.Build -}}
{{ $katex := resources.Get "js/vendor/katex/dist/katex.js" -}}
{{ $katexAutoRender := resources.Get "js/vendor/katex/dist/contrib/auto-render.js" -}}
{{ $app := resources.Get "js/app.js" -}}
{{ $slice := slice $app -}}
@@ -42,12 +39,6 @@
{{ $slice = $slice | append $darkMode -}}
{{ end -}}
{{ if .Site.Params.options.kaTex -}}
{{ $katexConfig := resources.Get "js/katex.js" -}}
{{ $katexConfig := $katexConfig | js.Build -}}
{{ $slice = $slice | append $katexConfig -}}
{{ end -}}
{{ $js := $slice | resources.Concat "main.js" -}}
{{ if eq (hugo.Environment) "development" -}}
@@ -57,10 +48,6 @@
{{ if .Site.Params.options.highLight -}}
<script src="{{ $highlight.RelPermalink }}" defer></script>
{{ end -}}
{{ if .Site.Params.options.kaTex -}}
<script src="{{ $katex.RelPermalink }}" defer></script>
<script src="{{ $katexAutoRender.RelPermalink }}" onload="renderMathInElement(document.body);" defer></script>
{{ end -}}
<script src="{{ $js.RelPermalink }}" defer></script>
{{ if .Site.Params.options.flexSearch -}}
<script src="{{ $index.RelPermalink }}" defer></script>
@@ -70,18 +57,12 @@
{{ $index := $index | minify | fingerprint "sha512" -}}
{{ $bs := $bs | minify | fingerprint "sha512" -}}
{{ $highlight := $highlight | minify | fingerprint "sha512" -}}
{{ $katex := $katex | minify | fingerprint "sha512" -}}
{{ $katexAutoRender := $katexAutoRender | minify | fingerprint "sha512" -}}
{{ if .Site.Params.options.bootStrapJs -}}
<script src="{{ $bs.RelPermalink }}" integrity="{{ $bs.Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ end -}}
{{ if .Site.Params.options.highLight -}}
<script src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ end -}}
{{ if .Site.Params.options.kaTex -}}
<script src="{{ $katex.RelPermalink }}" integrity="{{ $katex.Data.Integrity }}" crossorigin="anonymous" defer></script>
<script src="{{ $katexAutoRender.RelPermalink }}" integrity="{{ $katexAutoRender.Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ end -}}
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ if .Site.Params.options.flexSearch -}}
<script src="{{ $index.RelPermalink }}" integrity="{{ $index.Data.Integrity }}" crossorigin="anonymous" defer></script>

View File

@@ -1,6 +1,2 @@
<link rel="preload" as="font" href="{{ "fonts/vendor/jost/jost-v4-latin-regular.woff2" | relURL }}" type="font/woff2" crossorigin>
<link rel="preload" as="font" href="{{ "fonts/vendor/jost/jost-v4-latin-700.woff2" | relURL }}" type="font/woff2" crossorigin>
{{ if .Site.Params.options.kaTex -}}
<link rel="preload" as="font" href="{{ "fonts/KaTeX_Main-Regular.woff2" | relURL }}" type="font/woff2" crossorigin>
<link rel="preload" as="font" href="{{ "fonts/KaTeX_Math-Italic.woff2" | relURL }}" type="font/woff2" crossorigin>
{{ end -}}
<link rel="preload" as="font" href="{{ "fonts/vendor/jost/jost-v4-latin-700.woff2" | relURL }}" type="font/woff2" crossorigin>

View File

@@ -33,8 +33,7 @@
"test": "npm run -s lint",
"env": "env",
"precheck": "npm version",
"check": "hugo version",
"copy:katex-fonts": "shx cp ./node_modules/katex/dist/fonts/* ./static/fonts/"
"check": "hugo version"
},
"devDependencies": {
"@babel/cli": "^7.14",
@@ -49,7 +48,6 @@
"highlight.js": "^10.7",
"hugo-bin": "^0.71",
"instant.page": "^5.1",
"katex": "^0.13",
"lazysizes": "^5.3",
"markdownlint-cli": "^0.27",
"mermaid": "^8.10",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1 +1 @@
{"name":"Doks Theme","short_name":"Doks","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#fff","background_color":"#fff","display":"standalone"}
{"name":"Kerberos.io Docs","short_name":"Docs","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#fff","background_color":"#fff","display":"standalone"}

View File

@@ -4720,13 +4720,6 @@ jwt-decode@^3.0.0:
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59"
integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==
katex@^0.13:
version "0.13.11"
resolved "https://registry.yarnpkg.com/katex/-/katex-0.13.11.tgz#66138ebf173f25ef130cd3a3ea3ea1d12a3f1362"
integrity sha512-yJBHVIgwlAaapzlbvTpVF/ZOs8UkTj/sd46Fl8+qAf2/UiituPYVeapVD8ADZtqyRg/qNWUKt7gJoyYVWLrcXw==
dependencies:
commander "^6.0.0"
keyv@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.0.0.tgz#44923ba39e68b12a7cec7df6c3268c031f2ef373"