enable either mathjax or katex

Fixes slashformotion/hugo-tufte#9
This commit is contained in:
slashformotion 2021-07-30 21:07:51 +02:00
parent ce4028226f
commit 37ecc69ecc
2 changed files with 52 additions and 15 deletions

View file

@ -1,23 +1,32 @@
# Remove this if your site folder is not inside the theme folder
themesDir = "../../" themesDir = "../../"
canonifyurls = true # Set your theme here
baseurl = "https://slashformotion.github.io/hugo-tufte/"
theme = "hugo-tufte" theme = "hugo-tufte"
# The url of your website
baseurl = "https://slashformotion.github.io/hugo-tufte/"
# The title of your website (shown on all the pages)
title = "Hugo-tufte Theme Example Site" title = "Hugo-tufte Theme Example Site"
pygmentsUseClasses=true # Site wide kill switch for Latex support
[taxonomies] math = true
category = "categories" # (If math is enabled)
group = "groups" ## if "katex" is set to true katex will be used to render LaTex, if not MathJax will be used instead
series = "series" katex = false
tag = "tags"
[params] [params]
math = true # Subtitle of the website
subtitle = "Subtitle goes here." subtitle = "Subtitle goes here."
# Your name or the name of you company
copyrightHolder = "Copyright Holder" copyrightHolder = "Copyright Holder"
# Show the "Powered by Hugo-Tufte and Hugo."
showPoweredBy = true showPoweredBy = true
# Site wide kill switch
hidedate = false hidedate = false
[taxonomies]
category = "categories"
series = "series"
tag = "tags"
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Navigation menu # Navigation menu
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
@ -63,8 +72,11 @@ pygmentsUseClasses=true
url = "https://twitter.com" url = "https://twitter.com"
# Don't change the settings below
[markup] [markup]
[markup.goldmark] [markup.goldmark]
[markup.goldmark.renderer] [markup.goldmark.renderer]
unsafe = true unsafe = true # make the shortcodes work
pygmentsUseClasses=true
canonifyurls = true

View file

@ -1,4 +1,29 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css"> {{ if .Params.katex }}
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js"></script> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js"></script>
<script>
renderMathInElement(
document.body,
{
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "\\[", right: "\\]", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false }
],
displayMode: true
}
);
</script>
{{ else }}
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>
window.MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']]
}
};
</script>
{{ end }}