Rongbin Fan

Markdown 语法测试

参考自 PaperMod 的 Markdown 语法示例页面

This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.

Headings

The following HTML <h1><h6> elements represent six levels of section headings. <h1> is the highest section level while <h6> is the lowest.

H1

H2

H3

H4

H5
H6

Paragraph

Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.

Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.

如果要加粗的内容最末带标点符号,Markdown渲染会出现问题。例如在Obsidian中的这个bug。建议在加粗时,不要包括进最后一个标点符号

Blockquotes

The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer or cite element, and optionally with in-line changes such as annotations and abbreviations.

Blockquote without attribution

Tiam, ad mint andaepu dandae nostion secatur sequo quae. Note that you can use Markdown syntax within a blockquote.

Blockquote with attribution

Don’t communicate by sharing memory, share memory by communicating.

Rob Pike1

Tables

Tables aren’t part of the core Markdown spec, but Hugo supports them out-of-the-box.

Name Age
Bob 27
Alice 23

Inline Markdown within tables

Italics Bold Code
italics bold code

List Types

Ordered List

  1. First item
  2. Second item
  3. Third item

Unordered List

Nested Unordered list

Nested Ordered list

  1. Fruit
    • Apple
    • Orange
    • Banana
  2. Dairy
    1. Milk
    2. Cheese
  3. Third item
    1. Sub One
    2. Sub Two

Other Elements — abbr, sub, sup, kbd, mark

GIF is a bitmap image format.

H2O

Xn + Yn = Zn

Press CTRL+ALT+Delete to end the session.

Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures.

KaTeX

需要在文章头部加入:

katex: true

$$ \begin{aligned} KL(\hat{y} || y) &= \sum_{c=1}^{M}\hat{y}_c \log{\frac{\hat{y}_c}{y_c}} \ JS(\hat{y} || y) &= \frac{1}{2}(KL(y||\frac{y+\hat{y}}{2}) + KL(\hat{y}||\frac{y+\hat{y}}{2})) \end{aligned} $$

对于包括\的情况,需要再加一条斜杠来转义,如下:

\begin{pmatrix}
  a & b \\\ 
  % 需要多一条斜杠
      c & d
      \end{pmatrix}

$$ \begin{pmatrix} a & b \\ c & d \end{pmatrix} $$

对于包括_的情况,同样需要添加斜杠来转义,如下:

\underbrace{a}\_{b} - \underbrace{c}\_{d}

$$ \underbrace{a}_{b} - \underbrace{c}_{d} $$

也可以在公式外用{{< rawhtml >}}2包裹,则不需要添加斜杠:

{{< rawhtml >}}
$$
Y = 
\begin{bmatrix}
    \alpha_{1,1}\mathbf{x}_1 +...+ \alpha_{1,M}\mathbf{x}_M \\
    \vdots  \\
    \alpha_{N,1}\mathbf{x}_1 +...+ \alpha_{N,M}\mathbf{x}_M 
\end{bmatrix}
$$
{{< /rawhtml >}}
$$ Y = \begin{bmatrix} \alpha_{1,1}\mathbf{x}_1 +...+ \alpha_{1,M}\mathbf{x}_M \\ \vdots \\ \alpha_{N,1}\mathbf{x}_1 +...+ \alpha_{N,M}\mathbf{x}_M \end{bmatrix} $$

  1. The above quote is excerpted from Rob Pike’s talk during Gopherfest, November 18, 2015. ↩︎

  2. 注意在Hugo中,shortcode会先于Markdown渲染。如果要将其包含在代码块中,需要将< ... >改为</* ... */>。 ↩︎