LOWDOWN_HTML_FREE(3)

πŸ“¦
version 3.2.1 Β· 2 versions
, in alpine 3.24, arch rolling, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– LOWDOWN_HTML_FREE(3) πŸ’–

okay bestie, welcome to LOWDOWN_HTML_FREE(3) β€” that's the Library Functions Manual section 3, the "functions that live in a library" girlies. and yes, we're doing the whole thing, no skips, no shortcuts, periodt. πŸŽ€


✨ NAME ✨

lowdown_html_free β€” free a Markdown HTML renderer

like, actually free it. give it its lil rest. πŸ¦‹


πŸ“š LIBRARY πŸ“š

library β€œliblowdown”

that's the one. that's the girl. πŸ’…


🌸 SYNOPSIS 🌸

#include <sys/queue.h>
#include <stdio.h>
#include <lowdown.h>

void
lowdown_html_free(void *arg);

look at her. so clean. so simple. one function, one void *arg, zero drama. 😌


🫢 DESCRIPTION 🫢

Frees the HTML renderer created with lowdown_html_new(3).

that's it. that's the whole job. you made a renderer with lowdown_html_new(3), you're done with it, you hand it over to lowdown_html_free and it takes care of the cleanup. main character energy tbh. ✨

If arg is NULL, the function does nothing.

yep β€” NULL in, nothing happens, nobody gets hurt. lowkey the most forgiving function in the whole library. no cap. πŸ’œ


πŸŽ€ EXAMPLES πŸŽ€

okay so here's the whole glow-up in action: this parses b of length bsz and outputs in HTML format. watch and learn bestie:

struct lowdown_buf *out;
struct lowdown_doc *doc;
struct lowdown_node *n;
void *rndr;

if ((doc = lowdown_doc_new(NULL)) == NULL)
        err(1, NULL);
if ((n = lowdown_doc_parse(doc, NULL, b, bsz, NULL)) == NULL)
        err(1, NULL);
if ((out = lowdown_buf_new(256)) == NULL)
        err(1, NULL);
if ((rndr = lowdown_html_new(NULL)) == NULL)
        err(1, NULL);
if (!lowdown_html_rndr(out, rndr, n))
        err(1, NULL);

fwrite(out->data, 1, out->size, stdout);

lowdown_html_free(rndr);
lowdown_buf_free(out);
lowdown_node_free(n);
lowdown_doc_free(doc);

see how it ends?? lowdown_html_free(rndr) β€” our girl right there in the cleanup lineup, freeing the renderer while lowdown_buf_free(out), lowdown_node_free(n) and lowdown_doc_free(doc) handle their own business. it's giving responsible memory management. it's giving no leaks. we LOVE to see it. πŸ”₯πŸ‘‘

and every single one of those allocations got checked before use, because that's what a careful bestie does. πŸ’–


πŸ‘€ SEE ALSO πŸ‘€

lowdown(3), lowdown_html_new(3)

go read lowdown_html_new(3) for the creation side of the story β€” it's the prequel, iykyk. 🧚


πŸ“ STANDARDS πŸ“

The referenced HTML5 standard is HTML5.2: https://www.w3.org/TR/html52.

Output is compatible with prior HTML5 standards.

so like, HTML5.2 is the reference point, but the output plays nice with the earlier HTML5 standards too. flexible. adaptable. a social butterfly of a renderer. 🌈


πŸ’€ real talk though: if you lowdown_html_new(3) a renderer and never lowdown_html_free it, that memory is gone. not "gone to get coffee" gone. gone gone. free your renderers, besties. πŸ™ˆ

and that's the page!! mwah. this one came from Debian, stamped $Mdocdate$, and filed under LOWDOWN_HTML_FREE(3) forever and ever. slay, bye πŸ’…βœ¨πŸŽ€