htmlcolor

package module
v0.0.0-...-c589f58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2019 License: MIT Imports: 5 Imported by: 6

README

htmlcolor

Html syntax highlighter for Go

Installation

go get github.com/x86kernel/htmlcolor

Example Code

package main

import (
        "bytes"
        "fmt"
        
        "github.com/x86kernel/htmlcolor"
)

func main() {
        htmlformatter := htmlcolor.NewFormatter()

        testhtml := []byte("<html>\n<head>\n<body>\n</body>\n</head>\n</html>")

        buffer := bytes.NewBuffer(make([]byte, len(testhtml)))
        htmlformatter.Format(buffer, testhtml)

        fmt.Println(buffer)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter struct {
	TagColor     SprintfFuncer
	BracketColor SprintfFuncer
	CommentColor SprintfFuncer
	AttrKeyColor SprintfFuncer
	AttrValColor SprintfFuncer
}

func NewFormatter

func NewFormatter() *Formatter

func (*Formatter) Format

func (f *Formatter) Format(dst io.Writer, src []byte) error

func (*Formatter) TagFprint

func (f *Formatter) TagFprint(dst io.Writer, token html.Token)

type SprintfFuncer

type SprintfFuncer interface {
	SprintfFunc() func(format string, a ...interface{}) string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL