Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,25 @@ tags: ["Hugo"]
### KaTeX
Make your mathematical notations pop.

For notations that should appear on their own line, use the block quotes `$$ ... $$`
Update your site configuration to enable the passthrough extension and define opening and closing delimiters for each passthrough element type, either block or inline. For example:

```
[markup]
[markup.goldmark]
[markup.goldmark.extensions]
[markup.goldmark.extensions.passthrough]
enable = true
[markup.goldmark.extensions.passthrough.delimiters]
block = [['\[', '\]'], ['$$', '$$']]
inline = [['\(', '\)']]
```

Then, for notations that should appear on their own line, use the block quotes `$$ ... $$`

$$ 5 \times 5 = 25 $$

For notations that should appear on the same line, use the inline quotes `$ ... $`
For notations that should appear on the same line, use the inline quotes `\( ... \)`

**Note**: *Enabling KaTeX will add external dependencies.*

### Tabs
Some content is just better viewed in tabs. Luckily we have a shortcode for that.
<p float="left">
Expand Down
2 changes: 1 addition & 1 deletion assets/css/lib/katex.css

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions assets/js/katex.js

This file was deleted.

1 change: 0 additions & 1 deletion assets/js/lib/auto-render.js

This file was deleted.

1 change: 0 additions & 1 deletion assets/js/lib/katex.js

This file was deleted.

9 changes: 9 additions & 0 deletions layouts/_default/_markup/render-passthrough.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- $opts := dict "output" "htmlAndMathml" "displayMode" (eq .Type "block") }}
{{- with try (transform.ToMath .Inner $opts) }}
{{- with .Err }}
{{ errorf "Unable to render mathematical markup to HTML using the transform.ToMath function. The KaTeX display engine threw the following error: %s: see %s." . $.Position }}
{{- else }}
{{- .Value }}
{{- $.Page.Store.Set "hasMath" true }}
{{- end }}
{{- end -}}
8 changes: 0 additions & 8 deletions layouts/partials/head/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
(resources.Get "js/light_dark.js")
(resources.Get "js/tabs.js") }}

{{/* Locally hosted code for KaTeX */}}
{{ $js = $js | append
(resources.Get "js/lib/katex.js")
(resources.Get "js/lib/auto-render.js") }}

{{/* Personal/custom scripts for KaTeX */}}
{{ $js = $js | append (resources.Get "js/katex.js") }}

{{/* Personal/custom scripts for table of contents */}}
{{ if not .Site.Params.hideToc }}
{{ $js = $js | append (resources.Get "js/toc.js") }}
Expand Down
119 changes: 0 additions & 119 deletions static/katex/README.md

This file was deleted.

Loading