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 … ^[This is a footnote.]

bla … ^[This is another footnote.]

苏命
苏命
副研究员

我的研究方向:水源地水质安全保障,主要针对水源地由于藻类爆发引起的水体嗅味问题开展研究。