Categorygithub.com/d4l3k/go-highlight
modulepackage
0.0.0-20170131091508-34974ebcad41
Repository: https://github.com/d4l3k/go-highlight.git
Documentation: pkg.go.dev

# README

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.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

Detect returns the detected language.
HTML highlights a piece of code in HTML.
Term highlights a piece of code for rendering in the terminal.

# Constants

The text highlight classes.
The text highlight classes.
The text highlight classes.

# Variables

Workers is the number of workers to use to detect the language.