Skip to content

smelt.html

Tier: Host — Available in every runtime, including headless mode.

HTML parsing: title extraction, link scraping, to_text, to_markdown, DDG results.

fun(source: string, base: string?): string[]

Extract all anchor href links from source. When base is supplied, relative URLs are resolved against it.

smelt.html.parse_ddg_results

fun(source: string): table

Parse a DuckDuckGo HTML results page into rows of { title, link, description }.

smelt.html.title

fun(source: string): string?

Return the <title> text of source, or nil if no title element is present.

smelt.html.to_markdown

fun(source: string, base: string?): table

Convert source HTML to a { title, content, links } table where content is markdown. Relative links resolve against base when supplied.

smelt.html.to_text

fun(source: string): string

Strip HTML tags from source and return the visible text content.