Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xyproto/splash
:ocean: Syntax highlight code embedded in HTML with a splash of color. Also includes the auto-updated Chroma style gallery.
https://github.com/xyproto/splash
chroma css gallery-page go highlighting html syntax syntax-highlighting
Last synced: 22 days ago
JSON representation
:ocean: Syntax highlight code embedded in HTML with a splash of color. Also includes the auto-updated Chroma style gallery.
- Host: GitHub
- URL: https://github.com/xyproto/splash
- Owner: xyproto
- License: bsd-3-clause
- Created: 2018-04-03T18:19:33.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-05-23T00:44:43.000Z (9 months ago)
- Last Synced: 2024-05-23T01:42:10.620Z (9 months ago)
- Topics: chroma, css, gallery-page, go, highlighting, html, syntax, syntax-highlighting
- Language: Go
- Homepage: https://xyproto.github.io/splash/docs/
- Size: 5.55 MB
- Stars: 27
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Splash
Syntax highlight code embedded in HTML with a splash of color by using the [chroma](https://github.com/alecthomas/chroma) package.
The generated output is tested by visual inspection in Chromium, Midori and Netsurf.
## Example usage
```go
package mainimport (
"os""github.com/xyproto/splash"
)func main() {
// Read "input.html"
inputHTML, err := os.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 := os.WriteFile("output.html", outputHTML, 0644); err != nil {
panic(err)
}
}
```## Available syntax highlighting styles
See the [Style Gallery](https://xyproto.github.io/splash/docs/) for a full overview of available styles and how they may appear.
## General information
* Version: 1.1.6
* License: BSD-3
* Author: Alexander F. Rødseth <[email protected]>