More detail: Syntax Highlighting | Hugo
| 1
2
3
 | function helloWorld () {
  alert("Hello, World!")
}
 | 
 
| 1
2
3
4
5
 | public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World!");
  }
}
 | 
 
| 1
2
3
4
5
 | package hello
fun main(args: Array<String>) {
  println("Hello World!")
}
 | 
 
| 1
2
3
4
5
6
7
 | #include <stdio.h>
/* Hello */
int main(void){
  printf("Hello, World!");
  return 0;
}
 | 
 
| 1
2
3
4
5
6
7
8
 | // 'Hello World!' program
#include <iostream>
int main(){
  std::cout << "Hello World!" << std::endl;
  return 0;
}
 | 
 
| 1
2
3
4
5
6
 | using System;
class HelloWorld{
  public static void Main(){
    System.Console.WriteLine("Hello, World!");
  }
}
 | 
 
| 1
2
3
4
5
 | <html>
<body>
  Hello, World!
</body>
</html>
 | 
 
| 1
2
3
4
5
6
7
 | package main
import fmt "fmt"
func main()
{
   fmt.Printf("Hello, World!\n");
}
 | 
 
| 1
2
3
 | object HelloWorld with Application {
  Console.println("Hello, World!");
}
 | 
 
| 1
2
3
 | <?php
  echo 'Hello, World!';
?>
 | 
 
no named code block
|  1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 | ## this is a comment
$ echo this is a command
this is a command
## edit the file
$vi foo.md
+++
date = "2014-09-28"
title = "creating a new theme"
+++
bah and humbug
:wq
## show it
$ cat foo.md
+++
date = "2014-09-28"
title = "creating a new theme"
+++
bah and humbug
$
 | 
 
highlight shortcode
example:
| 1
2
3
 | {{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}}
// ... code
{{< /highlight >}}
 | 
 
result:
| 199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
 | // GetTitleFunc returns a func that can be used to transform a string to
// title case.
//
// The supported styles are
//
// - "Go" (strings.Title)
// - "AP" (see https://www.apstylebook.com/)
// - "Chicago" (see http://www.chicagomanualofstyle.org/home.html)
//
// If an unknown or empty style is provided, AP style is what you get.
func GetTitleFunc(style string) func(s string) string {
  switch strings.ToLower(style) {
  case "go":
    return strings.Title
  case "chicago":
    tc := transform.NewTitleConverter(transform.ChicagoStyle)
    return tc.Title
  default:
    tc := transform.NewTitleConverter(transform.APStyle)
    return tc.Title
  }
}
 |