Documentation
¶
Overview ¶
Package htmlutil implements some html utility functions.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render renders a simplified version of the provided HTML node. It will strip doctype nodes, trim spaces on text nodes and insert indentation.
Note: Render doesn't guarantee that the semantics of the page are preserved.
Example ¶
package main import ( "log" "os" "github.com/mewkiz/pkg/htmlutil" ) func main() { n, err := htmlutil.ParseFile("testdata/0001.html") if err != nil { log.Fatalln(err) } htmlutil.Render(os.Stdout, n) }
Output: <html> <head> <meta charset="utf-8"> <title> 0001 </title> </head> <body> <img src="test.png" alt="test"> <p> Test page. </p> </body> </html>
func RenderClean ¶
RenderClean renders the provided HTML node and returns it as a string. It is a convenience function for html.Render.
func RenderToString ¶
RenderToString renders a simplified version of the provided HTML node and returns it as a string. It will strip doctype nodes, trim spaces on text nodes and insert indentation.
Note: RenderToString doesn't guarantee that the semantics of the page are preserved.
Types ¶
This section is empty.