Syntax Highlighting

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!';
?>
1
print("Hello, World!") 
1
2
3
4
(defn hello-world
  "A function print 'Hello world'."
  []
  (prn "Hello world"))
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<!DOCTYPE html>
<html>
<head>
  <title>{{ .Title }}</title>
</head>
<body>
  <h1>{{ .Title }}</h1>
  {{ .Content }}
</body>
</html>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{{ partial "header.html" . }}

  <h1>posts</h1>
  {{ range first 10 .Data.Pages }}
    {{ if eq .Type "post"}}
      <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
    {{ end }}
  {{ end }}

  <h1>pages</h1>
  {{ range .Data.Pages }}
    {{ if or (eq .Type "page") (eq .Type "about") }}
      <h2><a href="{{ .Permalink }}">{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}</a></h2>
    {{ end }}
  {{ end }}

{{ partial "footer.html" . }}

Detect the language

package hello

fun main(args: Array<String>) {
  println("Hello World!")
}
<?php
  echo 'Hello, World!';
?>

By {{< highlight go-html-template "linenos=table,hl_lines=1 3-7,linenostart=199" >}}..{{< / highlight >}}

199
200
201
202
203
204
205
206
<section id="main">
  <div>
   <h1 id="title">{{ .Title }}</h1>
    {{ range .Data.Pages }}
        {{ .Render "summary"}}
    {{ end }}
  </div>
</section>
updatedupdated2018-11-052018-11-05