// Package sanitize removes every trace of JavaScript from an HTML document so // the saved page is inert: a photograph, not a program. // // It parses with golang.org/x/net/html, walks the tree, and deletes scripts, // event handlers, javascript: URLs, and the dead preconnect/preload hints that // mean nothing offline — while leaving styles, images, fonts, forms, and all // semantic markup untouched so the layout survives intact. package sanitize import ( "bytes" "strings" "golang.org/x/net/html" "golang.org/x/net/html/atom" ) // Options tune a few edge behaviours; the zero value is the safe default // (scripts and noscript removed, meta-refresh removed). type Options struct { // KeepNoscript unwraps