Skip to content
/ splash Public

🌊 Syntax highlight code embedded in HTML with a splash of color. Also includes the auto-updated Chroma style gallery.

License

Notifications You must be signed in to change notification settings

xyproto/splash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Splash

Syntax highlight code embedded in HTML with a splash of color by using the chroma package.

The generated output is tested by visual inspection in Chromium, Midori and Netsurf.

Example usage

package main

import (
    "github.com/xyproto/splash"
    "io/ioutil"
)

func main() {
    // Read "input.html"
    inputHTML, err := ioutil.ReadFile("input.html")
    if err != nil {
        panic(err)
    }

    // Highlight the source code in the HTML document with the monokai style
    outputHTML, err := splash.Splash(inputHTML, "monokai")
    if err != nil {
        panic(err)
    }

    // Write the highlighted HTML to "output.html"
    if err := ioutil.WriteFile("output.html", outputHTML, 0644); err != nil {
        panic(err)
    }
}

Available syntax highlighting styles

See the Style Gallery for a full overview of available styles and how they may appear.

General information

About

🌊 Syntax highlight code embedded in HTML with a splash of color. Also includes the auto-updated Chroma style gallery.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published