layouts: add TikZJax support
Using the `tikz` shortcode, and adding the `tikz: true` metadata to a page's frontmatter, allows me to write TikZ diagram and have them rendered in the browser using JavaScript
This commit is contained in:
parent
a164d46508
commit
60f577f739
|
@ -7,6 +7,7 @@ tags:
|
|||
- test
|
||||
categories:
|
||||
favorite: false
|
||||
tikz: true
|
||||
---
|
||||
|
||||
## Test post please ignore
|
||||
|
@ -30,3 +31,11 @@ fn main() {
|
|||
```sh
|
||||
echo hello world | cut -d' ' -f 1
|
||||
```
|
||||
|
||||
### TikZJax support
|
||||
|
||||
{{% tikz %}}
|
||||
\begin{tikzpicture}
|
||||
\draw (0,0) circle (1in);
|
||||
\end{tikzpicture}
|
||||
{{% /tikz %}}
|
||||
|
|
5
layouts/partials/head-extra.html
Normal file
5
layouts/partials/head-extra.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<!-- TikZJax support -->
|
||||
{{ if (.Params.tikz) }}
|
||||
<link rel="stylesheet" type="text/css" href="https://tikzjax.com/v1/fonts.css">
|
||||
<script async src="https://tikzjax.com/v1/tikzjax.js"></script>
|
||||
{{ end }}
|
3
layouts/shortcodes/tikz.html
Normal file
3
layouts/shortcodes/tikz.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<script type="text/tikz">
|
||||
{{.Inner}}
|
||||
</script>
|
Loading…
Reference in a new issue