Markdown snippet for Hugo post

The solutions are mainly derived from Yihui’s JS library.

Code

By using:


` ` `r
a <- 1 + 1
...
` ` `

produces:

a = 1 + 1
...

MathJax

Solution:

  1. Add math-code.js. to static/js/.
  2. Add the following lines to layouts/partials/footer_section.html.

    <!-- 加入MathJax, 用于Markdown中输入数学公式 -->
    <!-- 如:`$x^2 + y^2 = z^2$` -->
    {{ if and (not .Params.disable_mathjax) (or (in (string .Content) "\\") (in (string .Content) "$")) }}
    <script async src="//mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script>
    {{ end }}
    
    

By using:

`$x^2 + y^2 = z^2$`

produces:

$x^2 + y^2 = z^2$

Footnote

Solution: add fix-footnote.js. to static/js/.

By using:

bla ...
^[This is a footnote.]

bla ...
^[This is another footnote.]

produces:

bla … 1

bla … 2


  1. This is a footnote. ^
  2. This is another footnote. ^
Avatar
Ming Su
Associate Professor of Environmental Engneering

My research interest is water quality problems in drinking water bodies, with a focus on harmful algal blooms and associated taste & odor problems.

Next
Previous
comments powered by Disqus