From 5b92c81a414f16c26e629b4fd4cf02a39486786d Mon Sep 17 00:00:00 2001 From: Menci Date: Fri, 9 Dec 2022 01:00:00 +0800 Subject: [PATCH] refactor: upgrade to new version of theme --- .gitignore | 1 + Pipfile | 2 +- Pipfile.lock | 48 +++----- docs/_static/css/extra.css | 135 ++++++++-------------- docs/_static/js/math-csr.js | 4 + docs/ds/treap.md | 4 +- docs/index.md | 4 +- docs/intro/thanks.md | 4 +- hooks/on_env.py | 13 +++ mkdocs.yml | 33 +++--- scripts/post-build/math/task-handler.ts | 14 +-- scripts/pre-build/install-theme-vendor.sh | 19 --- 12 files changed, 110 insertions(+), 171 deletions(-) create mode 100644 hooks/on_env.py diff --git a/.gitignore b/.gitignore index a6e87c9ee..f0b7781d2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ mkdocs-material/ .env .well-known/ node_modules/ +*.pyc diff --git a/Pipfile b/Pipfile index 165949ce8..40c711bdd 100644 --- a/Pipfile +++ b/Pipfile @@ -4,7 +4,7 @@ verify_ssl = true name = "pypi" [packages] -mkdocs = "*" +mkdocs = "==1.4.2" pymdown-extensions = "*" pygments = "*" beautifulsoup4 = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 328d18d59..7604dc5b9 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "d943edf1dc7bc16a7b9a27bae6d40e219fa96da781a5bdaf7d620c31eca9cc52" + "sha256": "f7cacde26603aea43f37ec10ece9d77e1ce717f847e1b43b1a5e6baf83903752" }, "pipfile-spec": 6, "requires": { @@ -29,7 +29,7 @@ "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3", "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18" ], - "index": "pypi", + "markers": "python_version >= '3.6'", "version": "==2022.12.7" }, "charset-normalizer": { @@ -37,7 +37,7 @@ "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845", "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==2.1.1" }, "click": { @@ -63,14 +63,6 @@ "markers": "python_version >= '3.5'", "version": "==3.4" }, - "importlib-metadata": { - "hashes": [ - "sha256:d5059f9f1e8e41f80e9c56c2ee58811450c31984dfa625329ffd7c0dad88a73b", - "sha256:d84d17e21670ec07990e1044a99efe8d615d860fd176fc29ef5c306068fda313" - ], - "markers": "python_version >= '3.7'", - "version": "==5.1.0" - }, "jinja2": { "hashes": [ "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852", @@ -81,11 +73,11 @@ }, "markdown": { "hashes": [ - "sha256:08fb8465cffd03d10b9dd34a5c3fea908e20391a2a90b88d66362cb05beed186", - "sha256:3b809086bb6efad416156e00a0da66fe47618a5d6918dd688f53f40c8e4cfeff" + "sha256:cbb516f16218e643d8e0a95b309f77eb118cb138d39a4f27851e6a63581db874", + "sha256:f5da449a6e1c989a4cea2631aa8ee67caa5a2ef855d551c88f9e309f4634c621" ], - "markers": "python_version >= '3.7'", - "version": "==3.4.1" + "markers": "python_version >= '3.6'", + "version": "==3.3.7" }, "markupsafe": { "hashes": [ @@ -143,11 +135,11 @@ }, "mkdocs": { "hashes": [ - "sha256:26bd2b03d739ac57a3e6eed0b7bcc86168703b719c27b99ad6ca91dc439aacde", - "sha256:b504405b04da38795fec9b2e5e28f6aa3a73bb0960cb6d5d27ead28952bd35ea" + "sha256:8947af423a6d0facf41ea1195b8e1e8c85ad94ac95ae307fe11232e0424b11c5", + "sha256:c8856a832c1e56702577023cd64cc5f84948280c1c0fcc6af4cd39006ea6aa8c" ], "index": "pypi", - "version": "==1.3.0" + "version": "==1.4.2" }, "packaging": { "hashes": [ @@ -159,19 +151,19 @@ }, "pygments": { "hashes": [ - "sha256:5eb116118f9612ff1ee89ac96437bb6b49e8f04d8a13b514ba26f620208e26eb", - "sha256:dc9c10fb40944260f6ed4c688ece0cd2048414940f1cea51b8b226318411c519" + "sha256:56a8508ae95f98e2b9bdf93a6be5ae3f7d8af858b43e02c5a2ff083726be40c1", + "sha256:f643f331ab57ba3c9d89212ee4a2dabc6e94f117cf4eefde99a0574720d14c42" ], "index": "pypi", - "version": "==2.12.0" + "version": "==2.13.0" }, "pymdown-extensions": { "hashes": [ - "sha256:3ef2d998c0d5fa7eb09291926d90d69391283561cf6306f85cd588a5eb5befa0", - "sha256:ec141c0f4983755349f0c8710416348d1a13753976c028186ed14f190c8061c4" + "sha256:0f8fb7b74a37a61cc34e90b2c91865458b713ec774894ffad64353a5fce85cfc", + "sha256:ac698c15265680db5eb13cd4342abfcde2079ac01e5486028f47a1b41547b859" ], "index": "pypi", - "version": "==9.5" + "version": "==9.9" }, "python-dateutil": { "hashes": [ @@ -300,14 +292,6 @@ ], "markers": "python_version >= '3.6'", "version": "==2.2.0" - }, - "zipp": { - "hashes": [ - "sha256:83a28fcb75844b5c0cdaf5aa4003c2d728c77e05f5aeabe8e95e56727005fbaa", - "sha256:a7a22e05929290a67401440b39690ae6563279bced5f314609d9d03798f56766" - ], - "markers": "python_version >= '3.7'", - "version": "==3.11.0" } }, "develop": {} diff --git a/docs/_static/css/extra.css b/docs/_static/css/extra.css index 6dd1151d5..8761bdedf 100644 --- a/docs/_static/css/extra.css +++ b/docs/_static/css/extra.css @@ -1,22 +1,44 @@ +/* Logo title */ +.md-header__topic:first-child { + font-weight: initial !important; +} + +/* Code font size in
*/ +details .linenos, details code { + font-size: inherit !important; +} + +/* Code block / tab in details */ +details > summary + .highlight:last-child, details > summary + .tabbed-set:last-child { margin: 0 -0.6rem !important; } +details > summary + .highlight:last-child > .highlighttable { margin: 0 !important; } + +/* Table full width */ +.md-typeset__table { display: block !important; } +.md-typeset table:not(.highlighttable) { display: table !important; } + .md-typeset table:not([class]) th { min-width: 0rem; } -blockquote.page-copyright{ - margin: 20px 0; - padding-left: 1.5rem; - border-left: 5px solid #ff1700; /* Just change the color value and that's it*/ + +.headerlink { transform: translateY(-2.5px); } + +.md-nav__link[for=__toc] .md-icon { margin-left: auto !important; } + +blockquote.page-time { + margin: 20px 0 !important; + border-left-color: #64b5f6 !important; /* Just change the color value and that's it*/ } -blockquote.page-time{ - margin: 20px 0; - padding-left: 1.5rem; - border-left: 5px solid #64b5f6; /* Just change the color value and that's it*/ +blockquote.page-copyright { + margin: 20px 0 !important; + border-left-color: #ff1700 !important; /* Just change the color value and that's it*/ } blockquote.page-copyright i.md-icon { display: inline-block; - transform: translateY(3.5px); - font-size: 0.9rem; margin-right: 5px; + transform: translateY(3.5px); + width: 18px; } + #myBtn { display: none; position: fixed; @@ -35,83 +57,26 @@ blockquote.page-copyright i.md-icon { background-color: #d3d3d3; } -span.mjpage { - overflow: auto; +#color-button > button { + cursor: pointer; + transition: opacity .25s; + display: inline-block; + width: 6.5rem; + margin-bottom: 0.2rem; + padding: 1.2rem 0.4rem 0.2rem; + font-size: 0.64rem; + text-align: left; } -span.mjpage > svg { - overflow-x: scroll; - max-width: none !important; +#color-button > button[data-md-color-primary] { + background-color: var(--md-primary-fg-color); + color: var(--md-primary-bg-color); +} +#color-button > button[data-md-color-primary=white] { + box-shadow: inset 0 0 0.05rem rgb(0 0 0 / 54%); } -span.mjpage__block > svg { - min-width: 80%; - max-width: none !important; +#color-button > button[data-md-color-accent] { + background-color: var(--md-accent-fg-color); + color: var(--md-code-bg-color); } - -.md-icon, .md-clipboard::before, .md-nav__title::before, .md-nav__button, .md-nav__link::after, .md-search-result__article--document::before, .md-source-file::before, .md-typeset .admonition > .admonition-title::before, .md-typeset details > .admonition-title::before, .md-typeset .admonition > summary::before, .md-typeset details > summary::before, .md-typeset .footnote-backref, .md-typeset .critic.comment::before, .md-typeset summary::after, .md-typeset .task-list-control .task-list-indicator::before { - font-family: 'Material Icons' !important; /* over ride is needed*/ - font-style: normal !important; /* over ride is needed*/ - font-variant: nomal !important; /* over ride is needed*/ -} - -#color-button { - text-align: unset !important; -} - -.md-sidebar--primary { - z-index: 14 !important; -} - -.md-header { - z-index: 12 !important; -} - -/* h1, h2, h3, h4 { - font-weight: 500 !important; -} - -h2 { - font-size: 2.8rem !important; -} - -h3 { - font-size: 2.4rem !important; -} - -h4 { - font-size: 2.0rem !important; -} - -h5 { - font-size: 1.6rem !important; -} - */ - - /* https://www.mdui.org/docs/shadow */ - -.mdui-shadow-0{-webkit-box-shadow:none!important;box-shadow:none!important} -.mdui-shadow-1{-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12)!important;box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12)!important} -.mdui-shadow-2{-webkit-box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)!important;box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)!important} -.mdui-shadow-3{-webkit-box-shadow:0 3px 3px -2px rgba(0,0,0,.2),0 3px 4px 0 rgba(0,0,0,.14),0 1px 8px 0 rgba(0,0,0,.12)!important;box-shadow:0 3px 3px -2px rgba(0,0,0,.2),0 3px 4px 0 rgba(0,0,0,.14),0 1px 8px 0 rgba(0,0,0,.12)!important} -.mdui-shadow-4{-webkit-box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)!important;box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12)!important} -.mdui-shadow-5{-webkit-box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 5px 8px 0 rgba(0,0,0,.14),0 1px 14px 0 rgba(0,0,0,.12)!important;box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 5px 8px 0 rgba(0,0,0,.14),0 1px 14px 0 rgba(0,0,0,.12)!important} -.mdui-shadow-6{-webkit-box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12)!important;box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12)!important} -.mdui-shadow-7{-webkit-box-shadow:0 4px 5px -2px rgba(0,0,0,.2),0 7px 10px 1px rgba(0,0,0,.14),0 2px 16px 1px rgba(0,0,0,.12)!important;box-shadow:0 4px 5px -2px rgba(0,0,0,.2),0 7px 10px 1px rgba(0,0,0,.14),0 2px 16px 1px rgba(0,0,0,.12)!important} -.mdui-shadow-8{-webkit-box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12)!important;box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12)!important} -.mdui-shadow-9{-webkit-box-shadow:0 5px 6px -3px rgba(0,0,0,.2),0 9px 12px 1px rgba(0,0,0,.14),0 3px 16px 2px rgba(0,0,0,.12)!important;box-shadow:0 5px 6px -3px rgba(0,0,0,.2),0 9px 12px 1px rgba(0,0,0,.14),0 3px 16px 2px rgba(0,0,0,.12)!important} -.mdui-shadow-10{-webkit-box-shadow:0 6px 6px -3px rgba(0,0,0,.2),0 10px 14px 1px rgba(0,0,0,.14),0 4px 18px 3px rgba(0,0,0,.12)!important;box-shadow:0 6px 6px -3px rgba(0,0,0,.2),0 10px 14px 1px rgba(0,0,0,.14),0 4px 18px 3px rgba(0,0,0,.12)!important} -.mdui-shadow-11{-webkit-box-shadow:0 6px 7px -4px rgba(0,0,0,.2),0 11px 15px 1px rgba(0,0,0,.14),0 4px 20px 3px rgba(0,0,0,.12)!important;box-shadow:0 6px 7px -4px rgba(0,0,0,.2),0 11px 15px 1px rgba(0,0,0,.14),0 4px 20px 3px rgba(0,0,0,.12)!important} -.mdui-shadow-12{-webkit-box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 12px 17px 2px rgba(0,0,0,.14),0 5px 22px 4px rgba(0,0,0,.12)!important;box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 12px 17px 2px rgba(0,0,0,.14),0 5px 22px 4px rgba(0,0,0,.12)!important} -.mdui-shadow-13{-webkit-box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12)!important;box-shadow:0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12)!important} -.mdui-shadow-14{-webkit-box-shadow:0 7px 9px -4px rgba(0,0,0,.2),0 14px 21px 2px rgba(0,0,0,.14),0 5px 26px 4px rgba(0,0,0,.12)!important;box-shadow:0 7px 9px -4px rgba(0,0,0,.2),0 14px 21px 2px rgba(0,0,0,.14),0 5px 26px 4px rgba(0,0,0,.12)!important} -.mdui-shadow-15{-webkit-box-shadow:0 8px 9px -5px rgba(0,0,0,.2),0 15px 22px 2px rgba(0,0,0,.14),0 6px 28px 5px rgba(0,0,0,.12)!important;box-shadow:0 8px 9px -5px rgba(0,0,0,.2),0 15px 22px 2px rgba(0,0,0,.14),0 6px 28px 5px rgba(0,0,0,.12)!important} -.mdui-shadow-16{-webkit-box-shadow:0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12)!important;box-shadow:0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12)!important} -.mdui-shadow-17{-webkit-box-shadow:0 8px 11px -5px rgba(0,0,0,.2),0 17px 26px 2px rgba(0,0,0,.14),0 6px 32px 5px rgba(0,0,0,.12)!important;box-shadow:0 8px 11px -5px rgba(0,0,0,.2),0 17px 26px 2px rgba(0,0,0,.14),0 6px 32px 5px rgba(0,0,0,.12)!important} -.mdui-shadow-18{-webkit-box-shadow:0 9px 11px -5px rgba(0,0,0,.2),0 18px 28px 2px rgba(0,0,0,.14),0 7px 34px 6px rgba(0,0,0,.12)!important;box-shadow:0 9px 11px -5px rgba(0,0,0,.2),0 18px 28px 2px rgba(0,0,0,.14),0 7px 34px 6px rgba(0,0,0,.12)!important} -.mdui-shadow-19{-webkit-box-shadow:0 9px 12px -6px rgba(0,0,0,.2),0 19px 29px 2px rgba(0,0,0,.14),0 7px 36px 6px rgba(0,0,0,.12)!important;box-shadow:0 9px 12px -6px rgba(0,0,0,.2),0 19px 29px 2px rgba(0,0,0,.14),0 7px 36px 6px rgba(0,0,0,.12)!important} -.mdui-shadow-20{-webkit-box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 20px 31px 3px rgba(0,0,0,.14),0 8px 38px 7px rgba(0,0,0,.12)!important;box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 20px 31px 3px rgba(0,0,0,.14),0 8px 38px 7px rgba(0,0,0,.12)!important} -.mdui-shadow-21{-webkit-box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 21px 33px 3px rgba(0,0,0,.14),0 8px 40px 7px rgba(0,0,0,.12)!important;box-shadow:0 10px 13px -6px rgba(0,0,0,.2),0 21px 33px 3px rgba(0,0,0,.14),0 8px 40px 7px rgba(0,0,0,.12)!important} -.mdui-shadow-22{-webkit-box-shadow:0 10px 14px -6px rgba(0,0,0,.2),0 22px 35px 3px rgba(0,0,0,.14),0 8px 42px 7px rgba(0,0,0,.12)!important;box-shadow:0 10px 14px -6px rgba(0,0,0,.2),0 22px 35px 3px rgba(0,0,0,.14),0 8px 42px 7px rgba(0,0,0,.12)!important} -.mdui-shadow-23{-webkit-box-shadow:0 11px 14px -7px rgba(0,0,0,.2),0 23px 36px 3px rgba(0,0,0,.14),0 9px 44px 8px rgba(0,0,0,.12)!important;box-shadow:0 11px 14px -7px rgba(0,0,0,.2),0 23px 36px 3px rgba(0,0,0,.14),0 9px 44px 8px rgba(0,0,0,.12)!important} -.mdui-shadow-24{-webkit-box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12)!important;box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12)!important} diff --git a/docs/_static/js/math-csr.js b/docs/_static/js/math-csr.js index e7e9de669..8a2d28fec 100644 --- a/docs/_static/js/math-csr.js +++ b/docs/_static/js/math-csr.js @@ -3,3 +3,7 @@ MathJax = { matchFontHeight: false } }; + +document$.subscribe(function () { + MathJax.typesetPromise(); +}); diff --git a/docs/ds/treap.md b/docs/ds/treap.md index 725be27fb..aa2c42150 100644 --- a/docs/ds/treap.md +++ b/docs/ds/treap.md @@ -636,8 +636,8 @@ int qnex(int val) { 我们知道在朴素的二叉查找树中按照递增的顺序插入节点,建出来的树是一个长链,按照中序遍历,自然可以得到这个区间。 -
- +
+
如上图,按照 $1\ 2\ 3\ 4\ 5$ 的顺序给朴素搜索树插入节点,中序遍历时,得到的也是 $1\ 2\ 3\ 4\ 5$。 diff --git a/docs/index.md b/docs/index.md index fe7b5ce65..5bc7e1784 100644 --- a/docs/index.md +++ b/docs/index.md @@ -94,6 +94,6 @@ title: OI Wiki
- - + +
diff --git a/docs/intro/thanks.md b/docs/intro/thanks.md index 4230f83d8..dcbe2b3b0 100644 --- a/docs/intro/thanks.md +++ b/docs/intro/thanks.md @@ -7,8 +7,8 @@ disqus: 大额捐赠将会记录在本页面下方或日后更合适的位置来表示感谢。
- - + +
* * * diff --git a/hooks/on_env.py b/hooks/on_env.py new file mode 100644 index 000000000..3a0f1d3f1 --- /dev/null +++ b/hooks/on_env.py @@ -0,0 +1,13 @@ +import re + +def _nav_math(): + raw_re = r"\\\((.+?)\\\)" + target = r'\(\1\)' + r = re.compile(raw_re) + def nav_math(s): + return r.sub(target, s).replace(" ", " ") + return nav_math + +def on_env(env, config, files, **kwargs): + env.filters["nav_math"] = _nav_math() + return env diff --git a/mkdocs.yml b/mkdocs.yml index b6822edf7..30dbf49ad 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,9 +12,6 @@ edit_uri: 'https://oi-wiki.org/edit-landing/?ref=' # Copyright copyright: 'Copyright © 2016 - 2022 OI Wiki Team' -google_analytics: - - 'UA-124485594-1' - - 'auto' # Contents nav: @@ -526,31 +523,30 @@ theme: include_search_page: false search_index_only: true favicon: 'favicon.ico' - - logo: - icon: 'school' - feature: - tabs: true + icon: + logo: 'material/school' + features: + - navigation.tabs + - navigation.instant font: text: 'Fira Sans' code: 'Fira Mono' +plugins: [] + +hooks: + - hooks/on_env.py + # Customization extra: - search: - language: 'jp' disqus: 'OI-Wiki' copyright: 'CC BY-SA 4.0SATA' pagetime: 'on' manifest: 'manifest.webmanifest' githash: '' - # notice: - # title: 'Hi' - # message: '欢迎点击这里对 OI Wiki 提一点建议' - # url: 'https://wj.qq.com/s2/4467592/b1e9' - # position: 'topCenter' - # progressBar: false - # timeout: false + analytics: + provider: google + property: UA-124485594-1 extra_javascript: - '_static/js/extra.js?v=16' @@ -563,9 +559,6 @@ extra_css: # Extensions markdown_extensions: - admonition - - codehilite: - guess_lang: false - linenums: true - def_list - footnotes - meta diff --git a/scripts/post-build/math/task-handler.ts b/scripts/post-build/math/task-handler.ts index ec7d6de87..557f9ae4b 100644 --- a/scripts/post-build/math/task-handler.ts +++ b/scripts/post-build/math/task-handler.ts @@ -138,14 +138,12 @@ export const taskHandler = new (class implements TaskHandler { element.replaceWith(html); }); - // Inject CSS element (if rendered any math elements) - if (mathElements.length > 0) { - const htmlFilePathToRoot = path.relative(this.siteDir, filePath); - const cssFilePathToHtml = path.relative(path.dirname(htmlFilePathToRoot), MATHJAX_TARGET_CSS_FILE); - document - .querySelector("head") - .insertAdjacentHTML("beforeend", ``); - } + // Inject CSS element (not checking if we have maths since we use instant loading) + const htmlFilePathToRoot = path.relative(this.siteDir, filePath); + const cssFilePathToHtml = path.relative(path.dirname(htmlFilePathToRoot), MATHJAX_TARGET_CSS_FILE); + document + .querySelector("head") + .insertAdjacentHTML("beforeend", ``); // Remove client-side rendering script document diff --git a/scripts/pre-build/install-theme-vendor.sh b/scripts/pre-build/install-theme-vendor.sh index 66927edc2..6a5d80431 100755 --- a/scripts/pre-build/install-theme-vendor.sh +++ b/scripts/pre-build/install-theme-vendor.sh @@ -27,22 +27,3 @@ for FILE in "${MATHJAX_REQUIRED_FILES[@]}"; do cp -r "$FILE_SOURCE_PATH" "$FILE_TARGET_PATH" done rm -rf "$TEMP_DIR" - -# Material Icons -TEMP_DIR="$(mktemp -d -t "download-material-icons-XXXXXXXX")" -MATERIAL_ICONS_URL=${MATERIAL_ICONS_URL:-"https://registry.npmjs.org/material-icons/-/material-icons-0.2.3.tgz"} -echo "Downloading material-icons to $TEMP_DIR" -echo "URL: $MATERIAL_ICONS_URL" -MATERIAL_ICONS_REQUIRED_FILES=( - "iconfont/material-icons.css" - "iconfont/MaterialIcons-Regular.woff" - "iconfont/MaterialIcons-Regular.woff2" -) -curl "$MATERIAL_ICONS_URL" | tar -C "$TEMP_DIR" -xzf - -for FILE in "${MATERIAL_ICONS_REQUIRED_FILES[@]}"; do - FILE_TARGET_PATH="$VENDOR_DIR/material-icons/$FILE" - FILE_SOURCE_PATH="$TEMP_DIR/package/$FILE" - mkdir -p "$(dirname "$FILE_TARGET_PATH")" - cp -r "$FILE_SOURCE_PATH" "$FILE_TARGET_PATH" -done -rm -rf "$TEMP_DIR"