diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2023-03-18 12:36:39 +0900 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2023-03-18 12:36:39 +0900 |
commit | 0154f00b08057faaa452105987cc6ef336058a92 (patch) | |
tree | cb4749106763b382956adde5c6602db7b2cb550a | |
parent | f4d3d4f01b539a3824ee000a275a3bcf3a5643c6 (diff) | |
download | site-0154f00b08057faaa452105987cc6ef336058a92.tar.gz |
Switch to MathML for web pages
-rw-r--r-- | .builds/auto.yml | 1 | ||||
-rw-r--r-- | .builds/shell.nix | 3 | ||||
-rw-r--r-- | _css/style.css | 3 | ||||
-rw-r--r-- | _layout/foot.html | 2 | ||||
-rw-r--r-- | _layout/head.html | 1 | ||||
-rwxr-xr-x | _libs/onlymathml | 8 |
6 files changed, 10 insertions, 8 deletions
diff --git a/.builds/auto.yml b/.builds/auto.yml index b446731..bcca7f6 100644 --- a/.builds/auto.yml +++ b/.builds/auto.yml @@ -17,6 +17,7 @@ tasks: - build: | cd site nix-shell .builds/shell.nix --run 'julia --project=@. .builds/franklin.jl' + nix-shell -p htmlq --run _libs/onlymathml nix-shell -p python3Packages.css-html-js-minify --run _libs/postprocess - deploy: | tar -cvzf site.tar.gz -C site/__site . diff --git a/.builds/shell.nix b/.builds/shell.nix index b73cc6c..8a1166d 100644 --- a/.builds/shell.nix +++ b/.builds/shell.nix @@ -7,9 +7,6 @@ mkShell { shellHook = '' npm install highlight.js # https://github.com/NixOS/nixpkgs/issues/152201 katex=${nodePackages.katex}/lib/node_modules/katex/dist - install -m 755 -d _css/fonts _libs/katex - install -m 644 $katex/katex.min.css _css - install -m 644 $katex/fonts/* _css/fonts install -m 644 $katex/{katex.min.js,contrib/auto-render.min.js} _libs/katex ''; } diff --git a/_css/style.css b/_css/style.css index 421b75f..8df5502 100644 --- a/_css/style.css +++ b/_css/style.css @@ -77,9 +77,6 @@ p, details { max-width: 100%; } -/* KaTeX */ -.katex { font-size: 1em !important } - /* Boxes */ .franklin-content blockquote, .note { margin: 0 -1rem; diff --git a/_layout/foot.html b/_layout/foot.html index 43530ed..8edabc4 100644 --- a/_layout/foot.html +++ b/_layout/foot.html @@ -1,6 +1,6 @@ {{if hasmath}}<script src=/libs/katex/katex.min.js></script> <script src=/libs/katex/auto-render.min.js></script> -<script>renderMathInElement(document.body)</script>{{end}} +<script>renderMathInElement(document.body, {output: 'mathml'})</script>{{end}} {{if hascode}}<script src=/libs/highlight/highlight.pack.js></script> <script>hljs.initHighlightingOnLoad()</script>{{end}} </body> diff --git a/_layout/head.html b/_layout/head.html index 3e4d65f..763c35f 100644 --- a/_layout/head.html +++ b/_layout/head.html @@ -1,6 +1,5 @@ {{insert hair.html}} {{isnotempty rss}}<meta name=description content="{{rss_description}}">{{end}} -{{if hasmath}}<link rel=stylesheet href=/css/katex.min.css>{{end}} {{isdef title}}<title>{{title}} - McSinyx</title>{{end}} <body> {{insert header.html}} diff --git a/_libs/onlymathml b/_libs/onlymathml new file mode 100755 index 0000000..5e49d37 --- /dev/null +++ b/_libs/onlymathml @@ -0,0 +1,8 @@ +#!/bin/sh +set -ex +for i in $(find . -name *.html) +do + t=$(mktemp) + htmlq --remove-nodes .katex-html < $i > $t + mv $t $i +done |