//go-highlightbyaldarund

go-highlight

A Go (Golang) code syntax highlighting library.

0
0
0
Go

go-highlight GoDoc Build Status

A Go (Golang) code syntax highlighting library. It uses automatically converted
highlight.js language definitions.

Usage

package main

import "github.com/d4l3k/go-highlight"

func main() {
  highlight.Highlight("go", `
    package main

    import "fmt"

    func main() {
      fmt.Println("Duck!")
    }
  `)
  /*
    <keyword>package</keyword> main

    <keyword>import</keyword> <string>"fmt"</string>

    <keyword>func</keyword> main() {
      fmt.Println(<string>"Duck!"</string>)
    }
  */
}

The code written by Tristan Rice is licensed under the MIT license.

The language definitions are ported from
highlight.js which is licensed
under the BSD licence.

[beta]v0.14.0