Special Formatting

In this post I will showcase some of the “special” features of YAMT. This post is pretty long, so let’s start with a Table of Content (ToC).

Table of Contents

Code:

* random line to make it work. This will be removed.
{:toc}

Syntax Highlight

In YAMT you can highlight code in various ways.

Basic example:

public static void main (String[] args){
    System.out.println("Hello World!");
}

Code:

    ``` lang
        //your code 
    ```


Example:

public static void main (String[] args){
    System.out.println("Hello World!");
}

Code:

    {/% highlight lang %}
        //your code 
    {/% endhighlight java %}
    //Remove the "/" before the "%" to make it work.


With line numbers:

1
2
3
public static void main (String[] args){
    System.out.println("Hello World!");
}

Code:

    {/% highlight lang linenos%}
        //your code 
    {/% endhighlight java %}
    //Remove the "/" before the "%" to make it work.


In case of a longer line, an horizontal scrollbar will be added automatically:

1
2
3
public static void main (String[] args){
    System.out.println("Hello World! This is a very long line of code, perharps too long...");
}


List of supported languages: Rouge Wiki.

Note: In /assets/css/syntax.css you can change the first declaration to choose if you want a scrollbar or text wrap.

MathJAX and LaTeX

YAMT supports LaTeX and MathJAX to write beautiful math. There are three ways to write math in YAMT. In this example I’ll use Bernoulli’s principle.

In fluid dynamics, Bernoulli’s principle states that an increase in the speed of a fluid occurs simultaneously with a decrease in static pressure or a decrease in the fluid’s potential energy.
Wikipedia

Block:

\[\frac{v^2} {2} + {g}{z} + \frac{p} {ρ} = constant\]
$$  \frac{v^2} {2} + {g}{z} + \frac{p} {ρ} = constant $$

Inline: \(\frac{v^2} {2} + {g}{z} + \frac{p} {ρ} = constant\)

$$  \frac{v^2} {2} + {g}{z} + \frac{p} {ρ} = constant $$

Another block: \[ \frac{v^2} {2} + {g}{z} + \frac{p} {ρ} = constant \]

\\[ \frac{v^2} {2} + {g}{z} + \frac{p} {ρ} = constant \\]

Another inline: \( \frac{v^2} {2} + {g}{z} + \frac{p} {ρ} = constant \)

\\( \frac{v^2} {2} + {g}{z} + \frac{p} {ρ} = constant \\)

Alerts

Warning!

<span class = "alert r"></span>

Solved.

<span class = "alert g"></span>

Careful.

<span class = "alert y"></span>

Gifs

YAMT supports optimized gifs in WebM and MP4 formats. I suggest to use a website like Convertio to converts your .gifs to WebM and MP4. WebM is the suggested format but it’s not supported by every browser (looking at you, Safari), so MP4 is used as fallback. Put both files in the gif folder and insert gifs in your post using

{_% include gif.html file = "mygif" %}

Delete the underscore to make it work.

If you want to use a gif as featured image, delete the “image” tag in the front matter and use instead the “gif” tag. As a parameter, use the filename without extensions.

Categories:

Tips   Markdown   Typography