Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCrossOrigin = errors.New(`file is from another origin, cannot be opened`)
Functions ¶
func ApplyHtmlTransformers ¶
func ApplyHtmlTransformers(raw []byte, trs ...HtmlTransformer) ([]byte, error)
Types ¶
type HtmlTransformer ¶
type NodeFilter ¶
func NegateNodeFilter ¶
func NegateNodeFilter(f NodeFilter) NodeFilter
type WebFileSystem ¶
type WebFileSystem interface { // 比如页面地址是:/page/ // 如果 url 是:1.txt,则打开 /page/1.txt // 如果 url 是:/other/2.txt,则打开 /other/2.txt OpenURL(url string) (fs.File, error) // relative: 结果是否只保留相对路径(前提是同源的情况下)。 Resolve(url string, relative bool) (*url.URL, error) }
URL 引用文件系统。
场景:前端相对路径链接。
func NewWebFileSystem ¶
func NewWebFileSystem(root fs.FS, base *url.URL) WebFileSystem
Click to show internal directories.
Click to hide internal directories.