Defer loading of KaTeX JS and Bergamot support code
This commit is contained in:
parent
c09fff455f
commit
fdcd4ddd60
|
@ -1,7 +1,7 @@
|
|||
<script src="{{ .Site.Params.bergamotJsUrl }}"></script>
|
||||
<script defer src="{{ .Site.Params.bergamotJsUrl }}"></script>
|
||||
{{ $style := resources.Get "scss/bergamot.scss" | resources.ToCSS | resources.Minify }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}">
|
||||
<script>
|
||||
<script defer>
|
||||
const renderRules =
|
||||
`
|
||||
PrecApp @ prec(app(?l, ?r), 100, left) <-;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<div id="{{ .Get "id" }}"></div>
|
||||
<script>
|
||||
window.Bergamot.run(null, '{{ .Get "id" }}', '{{ .Get "prompt" }}', '{{ .Inner }}', renderRules, '{{ .Get "query" }}');
|
||||
window.addEventListener('load', function() {
|
||||
window.Bergamot.run(null, '{{ .Get "id" }}', '{{ .Get "prompt" }}', '{{ .Inner }}', renderRules, '{{ .Get "query" }}');
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<script src="{{ .Site.Params.katexJsUrl }}" crossorigin="anonymous"></script>
|
||||
<script defer src="{{ .Site.Params.katexJsUrl }}" crossorigin="anonymous"></script>
|
||||
<script defer>
|
||||
class KatexExpressionShim extends HTMLElement {
|
||||
static observedAttributes = ["expression", "katex-options"];
|
||||
|
|
Loading…
Reference in New Issue
Block a user