roscopecoltran / go-highlight

A Go (Golang) code syntax highlighting library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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>)
    }
  */
}

Copyright

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.

About

A Go (Golang) code syntax highlighting library.

License:MIT License


Languages

Language:Go 99.7%Language:JavaScript 0.3%