Skip to content

Commit

Permalink
feat: math shortcode (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris authored Dec 12, 2020
1 parent fabe196 commit 76562b4
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Hugo IRIS Theme
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [Overview](#overview)
- [Features](#features)
- [Roadmap](#roadmap)
Expand Down Expand Up @@ -51,6 +50,7 @@ Hugo IRIS Theme
- [repo](#repo)
- [github-sponsors-list](#github-sponsors-list)
- [table](#table)
- [math](#math)
- [How to Update the Theme](#how-to-update-the-theme)
- [Special Thanks](#special-thanks)
- [Changelog](#changelog)
Expand Down Expand Up @@ -339,6 +339,20 @@ Please follow the instruction as the same as the `repo` shortcode.
|---|---|
| ![Shortcode table mouse out](https://raw.githubusercontent.com/peaceiris/hugo-theme-iris/master/exampleSite/static/images/shortcode_table_1.jpg) | ![Shortcode table mouse over](https://raw.githubusercontent.com/peaceiris/hugo-theme-iris/master/exampleSite/static/images/shortcode_table_2.jpg) |

### math

See also [the example page](https://hugothemeiris.peaceiris.app/posts/math/).

When you use the ampersand sign `&`, you need to use the following math shortcode.

```md
{{</* math */>}}
\begin{vmatrix}a & b\\
c & d
\end{vmatrix}
{{</* /math */>}}
```

<div align="right"><a href="#table-of-contents">Back to TOC ☝️</a></div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,27 @@ $$
$$
\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}
$$



## Math Shortcode

See also [this thread](https://discourse.gohugo.io/t/use-goldmark-mathjax-extension/25721).

### Input

```md
{{</* math */>}}
\begin{vmatrix}a & b\\
c & d
\end{vmatrix}
{{</* /math */>}}
```

### Output

{{< math >}}
\begin{vmatrix}a & b\\
c & d
\end{vmatrix}
{{< /math >}}
3 changes: 3 additions & 0 deletions layouts/shortcodes/math.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$$
{{ .Inner }}
$$
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"npm test"
],
"{README,CONTRIBUTING}.md": [
"npx doctoc@1.4.0 --github"
"npx doctoc@2.0.0 --github"
]
},
"repository": {
Expand Down

0 comments on commit 76562b4

Please sign in to comment.