github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/dependencies/mathjax.html (about) 1 {{- $page := .page }} 2 {{- $location := .location }} 3 {{- if eq $location "footer" }} 4 {{- with $page }} 5 {{- $init := "{}" }} 6 {{- if isset .Params "mathjaxinitialize" }} 7 {{- $init = .Params.mathJaxInitialize }} 8 {{- else if isset .Site.Params "mathjaxinitialize" }} 9 {{- $init = .Site.Params.mathJaxInitialize }} 10 {{- end }} 11 <script> 12 function useMathJax( config ){ 13 if( !Object.assign ){ 14 // We don't support MathJax for IE11 anyways, so bail out early 15 return; 16 } 17 window.MathJax = Object.assign( window.MathJax || {}, { 18 loader: { 19 load: ['[tex]/mhchem'] 20 }, 21 startup: { 22 elements: [ 23 '.math' 24 ] 25 }, 26 tex: { 27 inlineMath: [ 28 ['$', '$'], // allow for single dollars as we set startup.elements 29 ['\\(', '\\)'] 30 ] 31 }, 32 options: { 33 enableMenu: false // avoid translation hassle for context menu 34 } 35 }, config ); 36 } 37 useMathJax( JSON.parse({{ $init }}) ); 38 </script> 39 {{- if and (isset .Params "custommathjaxurl") .Params.customMathJaxURL }} 40 <script id="MathJax-script" async src="{{ .Params.customMathJaxURL }}"></script> 41 {{- else if and (isset .Site.Params "custommathjaxurl") .Site.Params.customMathJaxURL }} 42 <script id="MathJax-script" async src="{{ .Site.Params.customMathJaxURL }}"></script> 43 {{- else }} 44 <script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script> 45 {{- end }} 46 {{- end }} 47 {{- end }}