diff --git a/content/en/docs/contribute/style/style-guide.md b/content/en/docs/contribute/style/style-guide.md index a1dcac11d9..f53145f146 100644 --- a/content/en/docs/contribute/style/style-guide.md +++ b/content/en/docs/contribute/style/style-guide.md @@ -3,6 +3,7 @@ title: Documentation Style Guide linktitle: Style guide content_type: concept weight: 40 +math: true --- @@ -317,6 +318,18 @@ kind: Pod ... ``` +## Formulae and equations + +You can use the Docsy support for [diagrams and formulae](https://www.docsy.dev/docs/adding-content/diagrams-and-formulae/#latex-support-with-katex). + +For example: `\\(\frac{7}{9} \sqrt{K^8 s}\\)`, which renders as \\(\frac{7}{9} \sqrt{K^8 s}\\). + +Prefer inline formulae where reasonable, but you can use a `math` block if that's likely to help readers. + +Read the Docsy guide to find out what you need to change in your page to activate support; +if you have problems, add `math: true` to the page [front matter](https://gohugo.io/content-management/front-matter/) +(you can do this even if you think the automatic activation should be enough). + ## Kubernetes.io word list A list of Kubernetes-specific terms and words to be used consistently across the site. diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index ba32d285f9..9849fef6f3 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -10,6 +10,23 @@ {{- end }} +{{ $needKaTeX := or .Site.Params.katex.enable .Params.math .Params.chem -}} +{{ if $needKaTeX -}} +{{/* load stylesheet and scripts for KaTeX support */ -}} + + {{/* The loading of KaTeX is deferred to speed up page rendering */ -}} + + {{/* To automatically render math in text elements, include the auto-render extension: */ -}} + +{{ end -}} + {{ $jsBs := resources.Get "vendor/bootstrap/dist/js/bootstrap.bundle.js" -}} {{ $jsBase := resources.Get "js/base.js" }} {{ $jsAnchor := resources.Get "js/anchor.js" }}