GoTruncateHtml

module
v0.0.0-...-125d915 Latest Latest
Warning

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

Go to latest
Published: May 7, 2015 License: MIT

README

truncatehtml

truncatehtml is a Go package that contains just one function that will truncate a given byte slice to a maximum of maxlen visible characters and optionally append a string before closing any open tags (e.g. for an ellipsis). HTML tags are automatically closed generating valid HTML.

Usage

Import the package in your Go program.

import (
    "github.com/mborgerson/GoTruncateHtml/truncatehtml"
)

Call TruncateHtml passing in the byte slice, the max len, and the string that should be appended to the truncated HTML before closing the open tags.

func TruncateHtml(buf []byte, maxlen int, ellipsis string) ([]byte, error)

License

The MIT license.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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