Code Sample

Using Hugo or Pygments

The following are two code samples using syntax highlighting.

The following is a code sample using triple backticks ( ``` ) code fencing provided in Hugo. This is client side highlighting and does not require any special installation.

def test:
    x = x + 1
    y = x + x
    println("test)
    b ="tet"

testing csharp

  foreach (DirectoryInfo folder in RootDirectory.EnumerateDirectories())
{
        Console.WriteLine("{0}\t{1}",
        var x folder.Name,
        folder.LastWriteTime.ToString("d-M-yy"));
}

The following is a code sample using the “highlight” shortcode provided in Hugo. This is server side highlighting and requires Python and Pygments to be installed.

def test:
    x = x + 1
    y = x + x
    println("test)
    b ="tet"

And here is the same code with line numbers:

1var num1, num2, sum
2num1 = prompt("Enter first number")
3num2 = prompt("Enter second number")
4sum = parseInt(num1) + parseInt(num2) // "+" means "add"
5alert("Sum = " + sum) // "+" means combine into a string

See also