fix katex settings

This commit is contained in:
nganhkhoa 2023-12-14 22:57:26 +07:00
parent 9878ef3e1b
commit 729cec9211

View File

@ -20,21 +20,34 @@ export default {
onload="renderMathInElement(document.body);"></script> onload="renderMathInElement(document.body);"></script>
<script defer type="text/javascript"> <script defer type="text/javascript">
// delay until the whole page is rendered to run Katex const katexRender = () => {
setTimeout(() => {
renderMathInElement(document.body, { renderMathInElement(document.body, {
// customised options // customised options
// • auto-render specific keys, e.g.: // • auto-render specific keys, e.g.:
delimiters: [ delimiters: [
{left: '$$', right: '$$', display: true}, {left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false}, {left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false}, // {left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true} // {left: '\\[', right: '\\]', display: true}
], ],
// • rendering keys, e.g.: // • rendering keys, e.g.:
throwOnError : true throwOnError : true
}); });
}, 1000); };
// delay until the whole page is rendered to run Katex
setTimeout(() => {
katexRender();
}, 500);
// set katex to render everytime the page url changes
// single-page problem
var pushState = history.pushState;
history.pushState = function() {
console.log("bruh, url changes")
pushState.apply(history, arguments);
setTimeout(() => {katexRender();}, 500);
};
</script> </script>
<style> <style>