diff options
Diffstat (limited to 'content')
| -rw-r--r-- | content/overview-math/index.md (renamed from content/overview-math.md) | 12 | ||||
| -rw-r--r-- | content/overview-math/katex.png | bin | 0 -> 67960 bytes |
2 files changed, 11 insertions, 1 deletions
diff --git a/content/overview-math.md b/content/overview-math/index.md index c58f13b..88f5df4 100644 --- a/content/overview-math.md +++ b/content/overview-math/index.md @@ -16,6 +16,16 @@ You can use [KaTeX](https://katex.org) to render mathematical notations. You can enable the $\KaTeX$ support globally, per-section or per-page basis. <!-- more --> +# CSP Note + +KaTeX unfortunately requires `script-src 'unsafe-inline'` in the Content Security Policy. This is a security vulnerability, so this page will not render KaTeX correctly because this demo site uses best security practices. I have taken a picture below to show you what some of these formulas look like should you enable KaTeX. + +KaTeX js is designed to work even with dynamic content, but because Zola is a SSG it seems to me the best solution is to avoid using this javascript all-together, process our markdown files similar to how KaTeX autorender does, but do it during zola build. insert some `<span class="KaTeX_Main">` ...etc so that we basically render it during the build process. If complex mathematics were part of my daily life then I might be motivated to write such code for Zola. + +You will also see this page rendered correctly if you git clone this repo and use `zola serve` because then there will be no Content Security Policy in place. + +{{ img(src="katex.png" alt="KaTeX" w=568 h=1014) }} + ## Enable Globally To enable the $\KaTeX$ support globally, add `math = true` under `[extra]` of the `config.toml` @@ -25,7 +35,7 @@ and every section and page of your site will load the KaTeX [autorender extensio ```toml [extra] math = true -math_auto_render = true +math_auto_render = false ``` ## Per-section Basis diff --git a/content/overview-math/katex.png b/content/overview-math/katex.png Binary files differnew file mode 100644 index 0000000..acfb6ac --- /dev/null +++ b/content/overview-math/katex.png |
