Skip to content

mantyr/sanitize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang HTML Sanitize - alfa-alfa version

Build Status GoDoc Software License

This don't stable version

Installation

$ go get github.com/mantyr/sanitize
$ go get github.com/mantyr/goquery
$ go get github.com/mantyr/runner

Example

package main

import (
    "github.com/mantyr/sanitize"
)

func main() {
    sani := sanitize.New()
    sani.LoadFile("./testdata/test1.html")
    if sani.Error != nil {
        t.Errorf("Error open file, %q", "./testdata/test1.html")
    }
    sani.SetBaseHost("http://example.com/")
    sani.SetAudioPreload("none")

    sani.RemoveTags()
    sani.RemoveAttr()

    sani.RemoveParam()
    sani.FilterIframe()
    sani.FilterObject()
    sani.FilterEmbed()

    sani.FilterA()
    sani.FilterImg()

    sani.RemoveEmptyTags()

    html, err := sani.Dom.Find("body").Html()
}

Author

Oleg Shevelev

Releases

No releases published

Packages

No packages published