-
Notifications
You must be signed in to change notification settings - Fork 911
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add render hook for 'chem' code blocks
Auto activation of `math' and 'chem' blocks Add ability to enable KateX and/or mhchem for individual pages only Upgrade to KaTeX 0.16.3
- Loading branch information
Showing
4 changed files
with
192 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{ .Page.Store.Set "hasmhchem" true -}} | ||
|
||
{{/* set default delimiters */ -}} | ||
{{ $delimiter_left := "$$" -}} | ||
{{ $delimiter_right := "$$" -}} | ||
|
||
{{/* override delimiters if set in config file */ -}} | ||
{{ with $.Page.Site.Params.katex.options.delimiters -}} | ||
{{ range first 1 ( where . "display" true ) -}} | ||
{{ $delimiter_left = index . "left" -}} | ||
{{ $delimiter_right = index . "right" -}} | ||
{{ end -}} | ||
{{ end -}} | ||
|
||
{{/* output of chemical formulae */}} | ||
<div class="chem">{{ $delimiter_left -}} | ||
{{ .Inner | safeHTML -}} | ||
{{ $delimiter_right -}}</div>{{ "" -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
{{/* set default delimiters */}} | ||
{{ $delimiter_left := "$$" }} | ||
{{ $delimiter_right := "$$" }} | ||
{{ .Page.Store.Set "hasKaTeX" true -}} | ||
|
||
{{/* override delimiters if set in config file */}} | ||
{{ with $.Page.Site.Params.katex.options.delimiters }} | ||
{{ range first 1 ( where . "display" true ) }} | ||
{{ $delimiter_left = index . "left" }} | ||
{{ $delimiter_right = index . "right" }} | ||
{{ end }} | ||
{{end}} | ||
{{/* set default delimiters */ -}} | ||
{{ $delimiter_left := "$$" -}} | ||
{{ $delimiter_right := "$$" -}} | ||
|
||
{{/* override delimiters if set in config file */ -}} | ||
{{ with $.Page.Site.Params.katex.options.delimiters -}} | ||
{{ range first 1 ( where . "display" true ) -}} | ||
{{ $delimiter_left = index . "left" -}} | ||
{{ $delimiter_right = index . "right" -}} | ||
{{ end -}} | ||
{{ end -}} | ||
|
||
{{/* output of equation */}} | ||
<p>{{ $delimiter_left }} | ||
{{ .Inner | safeHTML }} | ||
{{ $delimiter_right }}</p> | ||
<div class="math">{{ $delimiter_left -}} | ||
{{ .Inner | safeHTML -}} | ||
{{ $delimiter_right }}</div>{{ "" -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters