/* HTML to readable text (htmltext.c), for the web_fetch tool: a forgiving single pass, not a
* browser. Headings, links, lists, code blocks, quotes and tables stay, as markdown; script,
* style, navigation and the rest of the page's machinery go. */
#ifndef PIC_HTMLTEXT_H
#define PIC_HTMLTEXT_H
#include
/* The page's links and images, made absolute by the caller: HREF is as written in the page;
* the result is malloc'd, or NULL to keep HREF as it is. NULL resolve_fn: kept as written. */
typedef char *(*pic_html_resolve_fn)(void *ctx, const char *href);
/* The text of the LEN bytes of HTML (UTF-8), malloc'd and NUL-terminated; NULL when out of
* memory. A becomes a first line "Title: ..." when there is one. */
char *pic_html_to_text(const char *html, size_t len, pic_html_resolve_fn resolve_fn, void *ctx);
/* The words of the LEN bytes of HTML (a snippet with in it, say) as plain text: markup
* and entities resolved, no markdown marks, links or images. Malloc'd, or NULL. */
char *pic_html_plain(const char *html, size_t len);
#endif