Adjustments to the katex integration, part 2.
This commit is contained in:
parent
5033f3a277
commit
eee22b08f5
6 changed files with 37 additions and 15 deletions
|
|
@ -796,9 +796,10 @@ Node.js software you need. To install them run:
|
||||||
|
|
||||||
## Math typesetting with Katex
|
## Math typesetting with Katex
|
||||||
|
|
||||||
Download the latest release from <https://github.com/KaTeX/KaTeX/releases>. Unpack and place the resulting "katex" directory in the root `assets/vendor` directory.
|
Download the latest release from <https://github.com/KaTeX/KaTeX/releases>. Unpack and place the resulting "katex" directory in the root `static` directory.
|
||||||
|
|
||||||
|
The resulting path should be `static/katex`. Then set the `math` param to "true" and write some math to be typeset.
|
||||||
|
|
||||||
The resulting path should be `assets/vendor/katex`. Then set the `math` param to true and write some math to be typeset.
|
|
||||||
|
|
||||||
## Getting help
|
## Getting help
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable no-undef */
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
||||||
21
assets/js/math.js
Normal file
21
assets/js/math.js
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* A JavaScript file for Katex auto renderer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
renderMathInElement(document.body, {
|
||||||
|
delimiters: [
|
||||||
|
{left: '$$', right: '$$', display: true},
|
||||||
|
{left: '$', right: '$', display: false}
|
||||||
|
],
|
||||||
|
throwOnError: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
/* eslint-disable no-undef, guard-for-in */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* A JavaScript file for flexsearch.
|
* A JavaScript file for flexsearch.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
import * as params from '@params';
|
import * as params from '@params';
|
||||||
|
/* eslint-enable */
|
||||||
|
|
||||||
|
/* eslint-disable no-undef, guard-for-in */
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
@ -14,8 +15,8 @@ import * as params from '@params';
|
||||||
const index = new FlexSearch.Document({
|
const index = new FlexSearch.Document({
|
||||||
document: {
|
document: {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
index: ['title','tags','content','date'],
|
index: ['title', 'tags', 'content', 'date'],
|
||||||
store: ['title','summary','date','permalink']
|
store: ['title', 'summary', 'date', 'permalink']
|
||||||
},
|
},
|
||||||
tokenize: 'forward'
|
tokenize: 'forward'
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
/* eslint-disable no-undef */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* A JavaScript file for analytic tracking.
|
* A JavaScript file for analytic tracking.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
import * as params from '@params';
|
import * as params from '@params';
|
||||||
|
/* eslint-enable */
|
||||||
|
|
||||||
|
/* eslint-disable no-undef */
|
||||||
const cookiebanner = params.cookieConsent;
|
const cookiebanner = params.cookieConsent;
|
||||||
const cookieconsent = localStorage.getItem('cookieconsent');
|
const cookieconsent = localStorage.getItem('cookieconsent');
|
||||||
const idSite = params.piwikSiteID;
|
const idSite = params.piwikSiteID;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
{{ $katex_style := resources.Get "vendor/katex/katex.min.css" | fingerprint -}}
|
<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}">
|
||||||
<link rel="stylesheet" href="{{ $katex_style.RelPermalink }}">
|
<script defer src="{{ "katex/katex.min.js" | relURL }}"></script>
|
||||||
{{ $katex := resources.Get "vendor/katex/katex.min.js" | fingerprint -}}
|
<script defer src="{{ "katex/contrib/auto-render.min.js" | relURL }}"></script>
|
||||||
<script defer src="{{ $katex.RelPermalink }}"></script>
|
{{ $math := resources.Get "js/math.js" | minify | fingerprint -}}
|
||||||
{{ $auto_render := resources.Get "vendor/katex/contrib/auto-render.min.js" | fingerprint -}}
|
<script defer src="{{ $math.RelPermalink }}"></script>
|
||||||
<script defer src="{{ $auto_render.RelPermalink }}" onload="renderMathInElement(document.body);"></script>
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue