fmthtml

package module
Version: v0.0.0-...-39f5e47 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: MIT Imports: 4 Imported by: 1

README

fmthtml - Go package for formatting HTML

fmthtml is an HTML formatter (pretty-printer) for Go.

Example

package main

import (
	"fmt"

	"github.com/kjk/fmthtml"
)

func main() {
  d := `<!DOCTYPE html><html><head><title>This is a title.</title></head><body>foo</body></html>`
  d = fmthtml.Format([]byte(d))
	fmt.Printf("%s\n", d)
}

Output:

<!DOCTYPE html>
<html>
  <head>
    <title>
      This is a title.
    </title>
  </head>
  <body>
    foo
  </body>
</html>

Docs

Documentation

Overview

package fmthtml provides an HTML formatting function.

Index

Constants

This section is empty.

Variables

View Source
var Condense bool

Condense any tag with no child tags (only text or nothing) onto a single line

Functions

func Format

func Format(s []byte) []byte

Format pretty-prints HTML

Types

This section is empty.

Jump to

Keyboard shortcuts

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