Extended Markdown Syntax
FixIt theme has some extended syntax elements for you to write articles.
Emoji Support
This part is shown in the emoji support page.
Mathematical Formula
FixIt theme supports mathematical formulas based on $\KaTeX$.
Set the property enable = true
under [params.math]
in your theme configuration
and the property math: true
of the article front matter to enable the automatic rendering of mathematical formulas.
Since Hugo generates HTML documents according to the syntax such as _
/*
/>>
when rendering Markdown documents,
and some text content in the form of escape characters
(such as \(
/\)
/\[
/\]
/\\
) escape processing will be performed automatically,
therefore, additional escape character expressions are required for these places to achieve automatic rendering:
_
->\_
*
->\*
>>
->\>>
\(
->\\(
\)
->\\)
\[
->\\[
\]
->\\]
\\
->\\\\
FixIt theme supports [raw
shortcode][raw-shortcode] to avoid these escape characters,
which helps you write raw mathematical formula content.
Example raw
input:
|
|
The rendered output looks like this:
Inline Formula
The default inline delimiters are:
$ ... $
\( ... \)
(escaped:\\( ... \\)
)
For example:
|
|
The rendered output looks like this:
$c = \pm\sqrt{a^2 + b^2}$ and \(f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi\)
Block Formula
The default block delimiters are:
$$ ... $$
\[ ... \]
(escaped:\\[ ... \\]
)\begin{equation} ... \end{equation}
(unnumbered:\begin{equation*} ... \end{equation*}
)\begin{align} ... \end{align}
(unnumbered:\begin{align*} ... \end{align*}
)\begin{alignat} ... \end{alignat}
(unnumbered:\begin{alignat*} ... \end{alignat*}
)\begin{gather} ... \end{gather}
(unnumbered:\begin{gather*} ... \end{gather*}
)\begin{CD} ... \end{CD}
goldmark.renderer.hardWraps
carefully, set it to true, Goldmark will render the newlines as <br>
elements.For example:
|
|
The rendered output looks like this:
$$ c = \pm\sqrt{a^2 + b^2} $$
\[ f(x)=\int_{-\infty}^{\infty} \hat{f}(\xi) e^{2 \pi i \xi x} d \xi \]
\begin{equation*} \rho \frac{\mathrm{D} \mathbf{v}}{\mathrm{D} t}=\nabla \cdot \mathbb{P}+\rho \mathbf{f} \end{equation*}
\begin{equation} \mathbf{E}=\sum_{i} \mathbf{E}_{i}=\mathbf{E}_{1}+\mathbf{E}_{2}+\mathbf{E}_{3}+\cdots \end{equation}
\begin{align} a&=b+c \\ d+e&=f \end{align}
\begin{alignat}{2} 10&x+&3&y = 2 \\ 3&x+&13&y = 4 \end{alignat}
\begin{gather} a=b \\ e=b+c \end{gather}
\begin{CD} A @>a>> B \\ @VbVV @AAcA \\ C @= D \end{CD}
Copy-tex
Copy-tex is an extension for $\KaTeX$.
By the extension, when selecting and copying $\KaTeX$ rendered elements, copies their $\LaTeX$ source to the clipboard.
Set the property copyTex = true
under [params.math]
in your theme configuration to enable Copy-tex.
Select and copy the formula rendered in the previous section, and you can find that the copied content is the LaTeX source code.
mhchem
mhchem is an extension for $\KaTeX$.
By the extension, you can write beautiful chemical equations easily in the article.
Set the property mhchem = true
under [params.math]
in your theme configuration to enable mhchem.
|
|
The rendered output looks like this:
$$ \ce{CO2 + C -> 2 CO} $$
$$ \ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} $$
Ruby Annotation
An extended Markdown syntax for ruby annotation is supported in FixIt theme:
|
|
The rendered output looks like this:
Hugo
Fraction
An extended Markdown syntax for fraction is supported in FixIt theme:
|
|
The rendered output looks like this:
Light/Dark
90/100
Font Awesome
FixIt theme uses Font Awesome as the icon library. You can easily use these icons in your articles.
Get the class
of icons you wanted from the Font Awesome website.
|
|
The rendered output looks like this:
Gone camping! Be back soon.
That is so funny!
Escape character
In some special cases (when writing this theme documentation ), your content will conflict with basic or extended Markdown syntax, and it is inevitable.
The escape character syntax can help you build the content you wanted:
|
|
For example, two :
will enable emoji syntax, which is not the behavior you want. The escape character syntax is like this:
|
|
The rendered output looks like this:
:joy: instead of 😂
Another example is:
|
|
The rendered output looks like this:
[link](#escape-character) instead of link.
Custom attribute
The premise is that you set
goldmark.parser.attribute.block
totrue
.
Enable custom attribute support for titles and blocks by adding attribute lists inside single curly brackets ({.myclass class="class1 class2"}
) and placing it after the Markdown element it decorates, on the same line for titles and on a new line directly below for blocks.
Hugo supports adding attributes (e.g. CSS classes) to Markdown blocks, e.g. tables, lists, paragraphs etc.
A blockquote with a CSS class:
|
|
The rendered output looks like this:
foo
bar
There are some current limitations: For tables you can currently only apply it to the full table, and for lists the ul
/ol
-nodes only, e.g.:
|
|
The rendered output looks like this:
- Fruit
- Apple
- Orange
- Banana
- Dairy
- Milk
- Cheese
Note that attributes in code fences must come after the opening tag, with any other highlighting processing instruction, e.g.:
|
|
Code Fences Extended
Code Block Attributes
You can add attributes to a code block, for example:
|
|
The rendered output looks like this:
|
|
Currently supported attributes include:
title
: The title of the code block.
Diagrams Support
This part is shown in the diagrams support page.