urlutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package urlutil provides URL resolution and sanitization for extracted content.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractBaseHref

func ExtractBaseHref(doc *goquery.Document) string

ExtractBaseHref finds the <base href="..."> value from the document.

func ResolveRelativeURLs

func ResolveRelativeURLs(element *goquery.Selection, pageURL string, docBaseHref string)

ResolveRelativeURLs resolves all relative URLs in the element against baseURL. It handles href, src, srcset, poster, and data-src attributes. docBaseHref overrides the base URL if a <base href> tag was present.

func SanitizeUnsafe

func SanitizeUnsafe(element *goquery.Selection)

SanitizeUnsafe strips dangerous elements, event handlers, and unsafe URLs from the extracted content to prevent XSS when the HTML is rendered.

Types

This section is empty.

Jump to

Keyboard shortcuts

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