--- title: "Syntax Highlighting" date: 2011-08-30T16:01:23+08:00 lastmod: 2018-11-05T16:01:23+08:00 draft: false tags: ["preview", "Syntax Highlighting", "tag-5"] categories: ["Syntax Highlighting"] toc: false --- ```js function helloWorld () { alert("Hello, World!") } ``` ```java public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` ```kotlin package hello fun main(args: Array) { println("Hello World!") } ``` ```c #include /* Hello */ int main(void){ printf("Hello, World!"); return 0; } ``` ```cpp // 'Hello World!' program #include int main(){ std::cout << "Hello World!" << std::endl; return 0; } ``` ```cs using System; class HelloWorld{ public static void Main(){ System.Console.WriteLine("Hello, World!"); } } ``` ```html Hello, World! ``` ```go package main import fmt "fmt" func main() { fmt.Printf("Hello, World!\n"); } ``` ```scala object HelloWorld with Application { Console.println("Hello, World!"); } ``` ```php ``` ```python print("Hello, World!") ``` ```clojure (defn hello-world "A function print 'Hello world'." [] (prn "Hello world")) ``` ```go-html-template {{ .Title }}

{{ .Title }}

{{ .Content }} ``` ```go-html-template {{ partial "header.html" . }}

posts

{{ range first 10 .Data.Pages }} {{ if eq .Type "post"}}

{{ .Title }}

{{ end }} {{ end }}

pages

{{ range .Data.Pages }} {{ if or (eq .Type "page") (eq .Type "about") }}

{{ .Type }} - {{ .Title }} - {{ .RelPermalink }}

{{ end }} {{ end }} {{ partial "footer.html" . }} ``` --- Detect the language ``` package hello fun main(args: Array) { println("Hello World!") } ``` ``` ``` --- By `{{}}..{{}}` {{< highlight go-html-template "linenos=table,hl_lines=1 3-7,linenostart=199" >}}

{{ .Title }}

{{ range .Data.Pages }} {{ .Render "summary"}} {{ end }}
{{< / highlight >}}