Hugo Code Block Tests

25 Feb 2024 25 Feb 2024 3 min read Hugo Markdown Test Page

This page lists various code blocks to test Hugo code blocks.

For supported languages and their names, see: https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages

Unstyled 

$ ping6 fe80::b4:f9f6:e5e9:727e
connect: Invalid argument
And here we have a very long line with a long URI: https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages
$ ping6 fe80::b4:f9f6:e5e9:727e
connect: Invalid argument
And here we have a very long line with a long URI: https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages

Base (no line numbers or line highlights) 

// This is a very long line that will intersect with the language text and copy button if we're not careful.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

// By the way, this is a very long line that will cause the code block to get a horizontal scroll bar!!!

namespace PInvokeTest {
  class Program {
    static void Main(string[] args) {
      print_line("Hello, PInvoke!");
    }

    [DllImport("NativeLib.dll")]
    private static extern void print_line(string str);
  }
}

Line Highlights 

// This is a very long line that will intersect with the language text and copy button if we're not careful.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

// By the way, this is a very long line that will cause the code block to get a horizontal scroll bar!!!

namespace PInvokeTest {
  class Program {
    static void Main(string[] args) {
      print_line("Hello, PInvoke!");
    }

    [DllImport("NativeLib.dll")]
    private static extern void print_line(string str);
  }
}

Everything 

Supported Language (line numbers and line highlights) 

// This is a very long line that will intersect with the language text and copy button if we're not careful.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

// By the way, this is a very long line that will cause the code block to get a horizontal scroll bar!!!

namespace PInvokeTest {
  class Program {
    static void Main(string[] args) {
      print_line("Hello, PInvoke!");
    }

    [DllImport("NativeLib.dll")]
    private static extern void print_line(string str);
  }
}

Plain Text (line numbers and line highlights) 

// This is a very long line that will intersect with the language text and copy button if we're not careful.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

// By the way, this is a very long line that will cause the code block to get a horizontal scroll bar!!!

namespace PInvokeTest {
  class Program {
    static void Main(string[] args) {
      print_line("Hello, PInvoke!");
    }

    [DllImport("NativeLib.dll")]
    private static extern void print_line(string str);
  }
}

Plain Text (no line numbers or line highlights) 

This is a simple text
that should be printed as is.

Plain Text (line numbers but no line highlights) 

This is a text that requires highlighting
and thus must have the <span>s and classes.

Plain Text (not line numbers but line highlights) 

This is a text that requires highlighting
and thus must have the <span>s and classes.

Unsupported Language (line numbers and line highlights) 

// This is a very long line that will intersect with the language text and copy button if we're not careful.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace PInvokeTest {
  class Program {
    static void Main(string[] args) {
      print_line("Hello, PInvoke!");
    }

    [DllImport("NativeLib.dll")]
    private static extern void print_line(string str);
  }
}

HTML (no line highlights) 

Highlighted HTML 

<html>
  <head>
    <title>Hello, HTML</title>
  </head>
  <body>
    <p>Some text here</p>
  </body>
</html>

Plain Text HTML 

<html>
  <head>
    <title>Hello, HTML</title>
  </head>
  <body>
    <p>Some text here</p>
  </body>
</html>

Shell 

CHANNEL=stable sh -c "$(curl -fsSL https://get.docker.com)"
$ CHANNEL=stable sh -c "$(curl -fsSL https://get.docker.com)"
> CHANNEL=stable sh -c "$(curl -fsSL https://get.docker.com)"