Simplify KaTeX loading, use minified versions

This commit is contained in:
daudix
2024-08-29 19:09:51 +03:00
parent 74eaa00a9b
commit 2c1ffc73bf
128 changed files with 613 additions and 17903 deletions

View File

@ -9,22 +9,6 @@
{%- endif %}
<title>{% include "partials/title.html" %}</title>
<link rel="canonical" href="{{ current_url | default(value='/') | safe }}" />
{%- if config.extra.katex %}
<link rel="stylesheet" href="{{ get_url(path="katex.css") }}">
<script defer src="{{ get_url(path="katex.js")}}"></script>
<script defer src="{{ get_url(path="auto-render.js") }}"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "$", right: "$", display: false},
]
});
});
</script>
{%- endif %}
{%- if config.markdown.highlight_code and config.markdown.highlight_theme == "css" %}
{%- if config.markdown.highlight_themes_css | length > 0 %}
@ -80,6 +64,10 @@
{%- set stylesheets = [ "style.css" ] %}
{%- if config.extra.katex %}
{%- set stylesheets = stylesheets | concat(with=["katex.css"]) %}
{%- endif %}
{%- if config.extra.stylesheets %}
{%- set stylesheets = stylesheets | concat(with=config.extra.stylesheets) %}
{%- endif %}
@ -94,19 +82,30 @@
<link type="text/css" rel="stylesheet" href="{{ get_url(path=stylesheet) | safe }}" />
{%- endfor %}
{%- if config.extra.goatcounter %}
<script type="text/javascript" data-goatcounter="https://{{ config.extra.goatcounter.user }}.{{ config.extra.goatcounter.host | default(value='goatcounter.com') }}/count" async src="//gc.zgo.at/count.js"></script>
<noscript>
<img src="https://{{ config.extra.goatcounter.user }}.{{ config.extra.goatcounter.host | default(value='goatcounter.com') }}/count?p={{ current_path | default(value='/') | safe }}" />
</noscript>
{%- endif %}
{%- if config.extra.show_copy_button %}
{%- include "partials/copy_button.html" %}
{%- endif %}
{%- set scripts = [] %}
{%- if config.extra.goatcounter %}
{%- set scripts = scripts | concat(with=["count.js"]) %}
{%- endif %}
{%- if config.extra.katex %}
{%- set scripts = scripts | concat(with=["katex.min.js", "auto-render.min.js"]) %}
<script>
document.addEventListener("DOMContentLoaded", function () {
renderMathInElement(document.body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
],
});
});
</script>
{%- endif %}
{%- if config.build_search_index %}
{%- include "partials/search.html" %}
{%- set scripts = scripts | concat(with=["elasticlunr.min.js"]) %}